1

hi I was compiling my program using make command previously because my program includes multiple header files. Since I added BOOST LIBRARIES I'm not able to compile with the same command and getting the following error.

In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x4746): undefined reference to`boost::system::generic_category()'
main.cpp:(.text+0x4752): undefined reference to `boost::system::generic_category()'
main.cpp:(.text+0x475e): undefined reference to `boost::system::system_category()'
CMakeFiles/WebcamFaceRec.dir/main.cpp.o: In function `boost::system::error_code::error_code()':
main.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17    ): undefined reference to `boost::system::system_category()'
CMakeFiles/WebcamFaceRec.dir/main.cpp.o: In function `boost::asio::error::get_system_category()':
main.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[_ZN5boost4asio5error19get_system_categoryEv]+0x5): undefined reference to `boost::system::system_category()'
collect2: error: ld returned 1 exit status
make[2]: *** [WebcamFaceRec] Error 1
make[1]: *** [CMakeFiles/WebcamFaceRec.dir/all] Error 2
make: *** [all] Error 2

I searched the link :g++ compile error but it was not helpful. Can someone please point me to the right link or even a small help will be appreciated.

Community
  • 1
  • 1
Ghost
  • 21
  • 1
  • 7
  • Adding `-lboost_system` to your linker flags should fix that. – dragosht Dec 08 '15 at 12:16
  • @dragosht i tried using `-lboost_system` and still it shows the same error. do i have to compile just the **main.cpp** file with it?? – Ghost Dec 09 '15 at 04:53
  • @dragosht i compiled my program using following command `gcc -o main *.cpp -lboost_system` and now i get the following error. '/usr/bin/ld: /tmp/ccM9CQjM.o: undefined reference to symbol '__cxa_free_exception@@CXXABI_1.3' //usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status' – Ghost Dec 09 '15 at 05:02

0 Answers0