Parser example

Issue #4 closed
Dennis Delin created an issue

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 toVector::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 toVector::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 toVector::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 totypeinfo 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 totypeinfo 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 toVector::BLF::File::~File()' clang: error: linker command failed with exit code 1 (use -v to see invocation)

Comments (4)

  1. Tobias Lorenz repo owner

    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".

  2. Tobias Lorenz 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?

  3. Tobias Lorenz repo owner

    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.

  4. Log in to comment