Author Topic: Linking Boost  (Read 3692 times)

Offline Luc Lieber

  • Single posting newcomer
  • *
  • Posts: 2
Linking Boost
« on: February 12, 2012, 04:49:33 pm »
I have a bad feeling that I already know the answer, but code::blocks doesn't provide a way to recursively add all libraries in a directory, does it?  Has anyone out there actually pilfered through the hundreds of directories generated by boost.build and manually added in the required libraries?  If so, what were you thinking?  Do you like pain??

Also, the build log window seems to auto-close itself after a successful compilation.  Is there any way to make it not auto-close?
« Last Edit: February 12, 2012, 04:51:26 pm by Luc Lieber »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Linking Boost
« Reply #1 on: February 12, 2012, 05:05:54 pm »
Has anyone out there actually pilfered through the hundreds of directories generated by boost.build and manually added in the required libraries?
My fully-compiled boost has exactly 19 libs and in my application I use 3-5 of these at max. Maybe you should try to better understand how boost works and when/what you need to link against. Notice that boost usually does not even require any library unless you are using platform specific stuff like threads. Even then, its one lib (for example).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Luc Lieber

  • Single posting newcomer
  • *
  • Posts: 2
Re: Linking Boost
« Reply #2 on: February 12, 2012, 05:12:39 pm »
And so the black-box approach of using libraries crumbles away into dust...suddenly, one has to research how the library works in order to use it.


Sorry if I sound disappointed, I just spent literally an entire week trying to set up mingw-w64 and that took more research than anything that I've ever attempted before.  Moving from MSVC to GCC was is the single biggest pain that I've ever experienced.

The libraries that I require are:
    Boost::Asio
    Boost::Filesystem
    Boost::IOStreams
    Boost::Regex
    Boost::Serialization
    Boost::Thread

in 32 and 64 bit flavors.

If there are indeed only 19 libraries, then I've done something wrong when building boost, because I have a hellova lot more than that in subdirectories debug/link-static, debug/threading-multi, release/link-static, debug/threading-multi, debug/link-static/, nested as deep as
Code
C:\libraries\boost_1_47\lib\mingw\chrono\build\gcc-mingw-4.6.1\release\link-static\runtime-link-static\threading-multi

If I may inquire, which *.lib / *.a files should be added to code::blocks' linker settings?  The ones in the top-most (release / debug) directories?
« Last Edit: February 12, 2012, 05:48:17 pm by Luc Lieber »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Linking Boost
« Reply #3 on: February 12, 2012, 06:52:30 pm »
If I may inquire, which *.lib / *.a files should be added to code::blocks' linker settings?  The ones in the top-most (release / debug) directories?
Oh dear, this is off-topic and actually should be asked in boost forums, but here you go:

You most likely compiled the 19 libs in 6 flavours. Depending on what of these flavours you want to use (debug/release/dynamic/static/32bit/64bit) you have to add exactly that library. So, if you write:
The libraries that I require are:
    Boost::Asio
    Boost::Filesystem
    Boost::IOStreams
    Boost::Regex
    Boost::Serialization
    Boost::Thread
...you have to add at max 6 boost libraries.

As an example. If you want to use Boost::Asio dynamically linked (DLL) for a 32 bit application in release mode use exactly that lib.

You cannot simply link against all boost libs and then hope the linker will do the right thing. This will fail!

For more information, please ask in the boost forum. Topic locked.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ