Sunday, June 17, 2012

[Resolved] Boost :: undefined reference to `boost::system::system_category()'

Ran into to a small compilation error today.
while compiling a program with the  boost::asio namespace, i got the following error:

/tmp/ccYz5ppN.o: In function `__static_initialization_and_destruction_0(int, int)':
CancelTimer.cpp:(.text+0x21a): undefined reference to `boost::system::generic_category()'
CancelTimer.cpp:(.text+0x226): undefined reference to `boost::system::generic_category()'
CancelTimer.cpp:(.text+0x232): undefined reference to `boost::system::system_category()'
/tmp/ccYz5ppN.o: In function `boost::system::error_code::error_code()':
CancelTimer.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17): undefined reference to `boost::system::system_category()'

Well it turns out the boost::system::error_code::error_code() depends on the boost_system library.

So compiling with the -lboost_system linker flag to locate the symbols in library libboost_system.so solved the problem for me.
 

No comments:

[Windows] Refreshing Environment variable for windows command prompt or Powershell

Sometimes, after installing a package like chocolatey ,or npm packages, it asks you to restart the cmd.exe or powershell window to reload t...