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:

Interview Question Preperation : Find longest subarray whose sum is equal to K

Software Engineering Practice interview question Given a array of N elements. Find the length of Longest Subarray whose sum is equal to give...