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 solved the problem for me.

Using Tcpdump to dump and read network traffic

Another Quick FYI tip. There are many network analyzer/reader utilities available on both Linux and Windows platform. There is of-course ...