Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linking boost.asio

I have a problem linking boost.asio. It uses boost.system and the linker errors start with:

/boost_1_39_0/boost/system/error_code.hpp:205: undefined reference to `boost::system::get_system_category()'

which means I need to link boost.system. I already built boost and I have now several lib files.

  • boost_system-mgw32-d-1_39.dll and lib
  • libboost_system-mgw34-d-1_39.lib
  • libboost_system-mgw34-mt-d-1_39.lib
  • libboost_system-mgw34-sd-1_39.lib

and some more. How do I link them? Which one do I use? Do I copy all of them together?

My system is win32+mingw+eclipse cdt+qt 4.5.2+qt integration for eclipse. I already learned that I need to at a LIBS= section to my .pro file.

Can you give my some hints?

Thank you.

like image 222
Tobias Langner Avatar asked Oct 27 '22 03:10

Tobias Langner


1 Answers

The libraries are named based on whether or not multi-threading support is enabled, static and dynamic linkage, debug and release mode, and more. Here's some details:

http://www.boost.org/doc/libs/1_39_0/more/getting_started/unix-variants.html#library-naming

I'm not sure about eclipse as I don't use it, but with gcc (and mingw) you need to specify both a directory to find the libraries in (-L) and the file to link with. For example, if you wanted to link with the single-threaded debug version:

-L/path/to/libraries -lboost_system-mgw34-sd-1_39

like image 59
Brett Gmoser Avatar answered Nov 15 '22 06:11

Brett Gmoser