views:

466

answers:

3

I've been trying to get the boost library working with Code::Blocks and am having some trouble.

When I first tried to get boost, all I did was download the latest zip file and extract it into the CodeBlocks folder. Then I set the compiler settings to look in the boost folder. This allowed me to compile, but not to link. I then read the BoostWindowsQuickReference. I removed everything I had related to boost from my machine, and started fresh.

I followed the instructions step by step, and the only thing that didn't go exactly as the instructions said was that the install-proper folder with the include\boost inside of it was in C: and not my CodeBlocks folder. So I simply copied it (just in case for some reason it needed to be there) to the CodeBlocks folder, which I thought odd because I already had a boost_1_40_0 folder there from downloading the .zip.

I then tried to compile a program and it came up with the exact same error. Then I realized that I forgot to put in the link library (Ex: boost_regex-mgw44-mt-1_40.lib). Now I get

error: ld.exe||cannot find -lboost_regex-mgw44-mt-1_40.lib|

I have a few questions:

  1. Obviously, what am I doing wrong?
  2. Will I need to put in a link library every time I want to use a boost facility (everything is separated into different files, there isn't just one big project.)
  3. Was it necessary to build the library with the boost-jam or could I have just extracted it and used it? (Probably a dumb question, but a small seed of doubt was planted when I got the exact same error.)
  4. Should I try nuwen's MinGW Distro? (Would it make things any easier?)

If any clarification is needed I'd be happy to do so. Thanks.

Edit: and now I can't compile regular programs. So I'm just starting fresh again.

A: 

1, it should be -lboost_regex-mgw44-mt-1_40

2, Read the document, most boost library doesn't require to link library

3,4, You should compile it yourself, or try nuwen's MinGW ( I'd installed it and it worked fine )

Fu4ny
nuwen's doesn't have a boostjam :P
A: 

BoostPro has Windows binaries available for the Boost libraries. If you download just the Boost sources, you will have to compile it, if you are using any of the libraries that are not header-only (such as boost regex). The BoostPro binaries will allow you to link to these without having to build anything.

thekidder
If you're looking for windows (Visual Studio) libraries for 1.40, you can get them at: http://boost.teeks99.com since they're not available from BoostPro yet.
teeks99
A: 

On Windows it doesn't really matter where you "install" Boost to. Just get the .7z, compile using bjam.exe and pass it the options you need. It will create a folder called "bin.v2" and put the resulting libs in there. In Code::Blocks, all you need to do is edit the project options and point the search path to boost_1_40_0\boost and manually input the libraries to link against (those from bin.v2). It should just work then.

Do not use a precompiled Boost library.

Svenstaro