0

I am trying to make a project which includes Boost library and Gstreamer framework in different boost threads.

I am using eclipse CDT (C++ lang) IDE to program. and I am facing this error "undefined reference to boost::system::generic_category()". I have looked at few of the similar posts which unanimously suggest to add -lboost_system and -lboost_thread in the g++ linking. However I am still facing the issue.

Here are few lines from the eclipse console that I am looking at:

Building target: IBMCmake

Invoking: GCC C++ Linker

g++ -L/usr/lib64 -L/usr/local/lib64 -L/usr/lib -o "IBMCmake"  ./src/WatsonAuth/IbmTokenGenerator.o  ./src/GstRtpDepay/GstRtpDepayloader.o  ./src/IbmWebSock.o ./src/main.o   -lboost_system -lboost_thread -lpthread -lglib-2.0 -lgstreamer-1.0 -lgobject-2.0 -lcurl -lssl -lcrypto
./src/GstRtpDepay/GstRtpDepayloader.o: In function `boost::system::error_category::std_category::equivalent(int, std::error_condition const&) const':
/usr/include/boost/system/error_code.hpp:676: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:679: undefined reference to `boost::system::generic_category()'
...
...
...
./src/IbmWebSock.o: In function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:449: undefined reference to `boost::system::system_category()'
...
...
...

I Am not sure what might be causing this. How do I get this error solved? Any Suggestions?

Please Note: "IBMCmake" is just a name given to the project by me. Not using cmake to compile.

RC0993
  • 898
  • 1
  • 13
  • 44
  • On some systems order of libraries and object files are important. If library A depends on library B, then A must come before B when linking. – Some programmer dude Jan 31 '19 at 07:17
  • Using `-DBOOST_SYSTEM_NO_DEPRECATED` [this link](https://stackoverflow.com/questions/9723793/undefined-reference-to-boostsystemsystem-category-when-compiling/30877725#30877725). I tried putting it `g++ -L/usr/lib64 -L/usr/lib -L/usr/local/lib -L/usr/local/lib64 -L/usr/local/lib64/gstreamer-1.0 -DBOOST_SYSTEM_NO_DEPRECATED -o "ABCDTest" ./src/WatsonAuth/IbmCallback.o ./src/WatsonAuth/TokenInit.o ./src/GstPipe/RtpToRaw.o ./src/IbmWebSock.o ./src/main.o -lboost_thread -lpthread -lcurl -lgobject-2.0 -lgstreamer-1.0 -lglib-2.0 -lssl -lcrypto -lboost_system` & failed. **suggestion?** – RC0993 Jan 31 '19 at 09:18
  • 1
    Have you got multiple versions of `libboost_system` and its header files installed, e.g. `/usr/include/boost` v `/usr/local/include/boost` and `/usr/lib64` v `/usr/local/lib64` – Mike Kinghan Jan 31 '19 at 10:26
  • Reinstallation of the boost solved the problem. Not aware of the Root cause of the mentioned problem. – RC0993 Jan 31 '19 at 12:28

1 Answers1

0

boost_system and boost_threads are usually system-integrated. Thus it is possible to have corrupted links or updated links.

I re-installed the boost from the instruction on Boost older versions

This solved the linking problem.

RC0993
  • 898
  • 1
  • 13
  • 44