Parser example
Hi,
Try to build the Parser example application.. But have some issues. Running on Linux 3.10.0-514.21.1.el7.x86_64 clang version 3.4.2 cmake version 3.10.0-rc3
tried with g++ first but then even more errors
-sh-4.2$ sudo clang++ -g -std=c++11 -Wall -pedantic -o Parse Parser.cpp
Parser.cpp:105:13: warning: 101 enumeration values not handled in switch: 'UNKNOWN',
'CAN_MESSAGE', 'CAN_ERROR'... [-Wswitch]
switch (environmentVariable->objectType) {
^
Parser.cpp:281:23: warning: comparison of integers of different signs: 'int' and 'DWORD'
(aka 'unsigned int') [-Wsign-compare]
for (int i = 0; i < mostPkt->pktDataLength; ++i) {
~ ^ ~~~~
Parser.cpp:307:23: warning: comparison of integers of different signs: 'int' and 'DWORD'
(aka 'unsigned int') [-Wsign-compare]
for (int i = 0; i < mostPkt2->pktDataLength; ++i) {
~ ^ ~~~~~
3 warnings generated.
/tmp/Parser-c0ede7.o: In function main':
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:729: undefined reference to
Vector::BLF::File::File()'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:730: undefined reference to Vector::BLF::File::open(char const*, Vector::BLF::File::OpenMode)'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:734: undefined reference to
Vector::BLF::File::eof()'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:735: undefined reference to Vector::BLF::File::read()'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:1189: undefined reference to
Vector::BLF::File::~File()'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:741: undefined reference to typeinfo for Vector::BLF::ObjectHeaderBase'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:741: undefined reference to
typeinfo for Vector::BLF::ObjectHeader'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:755: undefined reference to typeinfo for Vector::BLF::ObjectHeaderBase'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:755: undefined reference to
typeinfo for Vector::BLF::ObjectHeader2'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:1186: undefined reference to Vector::BLF::File::close()'
/usr/local/share/doc/Vector_BLF/examples/Parser.cpp:1189: undefined reference to
Vector::BLF::File::~File()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Comments (4)
-
repo owner -
repo owner - changed status to open
This is less of a bug, but more the feature to compile using clang.
-
repo owner After adding the CXX_STANDARD settings in src/Vector/BLF/CMakeLists.txt done in issue
#3, I'm able to compile with clang in the aforementioned version. Can you confirm that this issue is solved with v1.1.2, so the latest commit? -
repo owner - changed status to closed
The errors result from manually calling clang compiler with missing linker option "-lVector_BLF". The CMakeLists.txt calls the compilers (gcc, clang) correctly.
The warnings are indeed existing in the parser code, however it's just an example and does not need to conform to the coding standard of the library itself.
- Log in to comment
I use Debian Testing amd64, which includes gcc-7.2 and cmake-3.9. No issues here.
I never tried clang yet, but installed v3.8 now. It seems to require some changes to the CMakeLists.txt, which you also referred to in
#3. So I'll need to work on this first.I never compiled with "gcc -pedantic", but if I switch it on, it still works here.
The errors "undefined reference to" seem to result from a linker problem. If you run the compiler directly you need to add at least "-lVector_BLF".