How to fix "Undefined reference to boost::system::system_category()" ?

2,830 views
Skip to first unread message

Fabio Rende

unread,
Aug 4, 2014, 3:13:15 PM8/4/14
to webso...@googlegroups.com
Hello,
I'm unable to fix this problem.
I'm using Eclipse Kepler and I have installed MinGW 4.8.1.
I built boost library with this command: b2 toolset=gcc. Now in the folder stage/lib i have only ".a" files (documentation says they are for Unix while I'm using Windows).
They have this format: libboost_NAME-mgw48-mt-1_55 or libboost_NAME-mgw48-mt-d-1_55.

I included the path of the boost folder and websocketpp to the GCC C++ Compiler -> Includes. Then I've added library path (~/stage/lib) to the MinGW C++ Linker and the -lmswsock and -lws2_32 library (the last two to fix other problems).
I still get Undefined reference to boost::system::generic_category() and Undefined reference to boost::system::system_category()

If i add -lboost_system, it cannot find it. Same thing if i specify libboost_system-mgw48-mt-d-1_55.

Could you help me solving this problem?

Thank you.

Peter Thorson

unread,
Aug 5, 2014, 10:23:03 AM8/5/14
to Fabio Rende, webso...@googlegroups.com
Hi Fabio,

I don’t know much about Eclipse or MinGW or how code libraries work on Windows. I can tell you that the error you are getting is related to the boost_system library not being properly linked. The missing symbols are present in that library.

Some possible things to look at:
- On UNIX at least, the .a files would be libraries designed for static linking. -lboost_system will ask to dynamically link. To statically link you’d include the full path to the .a file in your link command along with all the other object files.
- With UNIX GCC the order in which object files and statically linked libraries are included in the link command can make a difference.
- Stack Overflow/MinGW lists/Boost lists may have a wider audience for more general questions about linking using MinGW than this list.

Peter

--
You received this message because you are subscribed to the Google Groups "WebSocket++" group.
To unsubscribe from this group and stop receiving emails from it, send an email to websocketpp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

osayande omondiagbe

unread,
Jul 29, 2018, 10:14:53 PM7/29/18
to WebSocket++
Hi Fabio,

DId you find a solution to this issue? as Im having similar solution

Wei Yang

unread,
Jul 30, 2018, 2:19:08 AM7/30/18
to WebSocket++
add -lboost_system in your compile command line?
Reply all
Reply to author
Forward
0 new messages