views:

1011

answers:

4

Where do I find the lib files for linking my program when using some Boost libraries? Decided to try its threading functionality but I am getting

Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice

after I include

Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice

I can't find where to get the .lib files for proper linking on the boost website? Any tips? :)

+4  A: 

Some of the Boost libraries need to be built (the ones that use OS-specific functions, for example). You can build them yourself, or download a pre-built package.

GMan
Thanks for the info. I better schedule some time in to build all those libraries. xDI bet it'll take awhile.
bobber205
@bobber205: grab the pre-built package and schedule a bunch of time to figure out how to build the entire boost distribution. It can take a few days to build under Windows the first time that you do it. The pre-built packages will get you up and running quickly.
D.Shawley
It take a little while sure, but a few days? What the heck are you doing? :D
KTC
@D.Shawley: Eek, a few days? I only remember it taking a couple hours, maybe.
GMan
@D.Shawley Even on my decrepit, 10-year old laptop, building the libraries only took a couple of hours, max.
anon
A: 

It all depends on which operating system / compiler you're using.

I suggest you download the boost source code and learn how to build Boost.

Assaf Lavie
Using windows 7 and VS2008.
bobber205
+1  A: 

An alternative solution I use is to create your own wrapper project with the bits of boost that you are using. Generally in VS.Net this is just a matter of just adding the cpp files from the boost/libs/blah subdirectory. They compile very cleanly so you don't normally need to do any other setting up of your project. I find this technique to be useful if you are wanting to automate builds from SCM and you don't want to check in binaries. It's also very fast as you only build the bits you need. Another advantage is that it's easier to create configurations that are relevant to your projects, ie Debug/Release, static/dynamic, 32/64 bit. One gotcha though is that you need to disable the auto-linking option by defining BOOST_ALL_NO_LIB when you build your project.

Alternatively, you'll need to use the jam tool to build the raw libraries for the configurations you require.

the_mandrill
IN conjunction with this, the bcp tool (provided in the boost distribution) will copy just the needed boost includes. This can help if you don't want all of boost in your SCM.
KeithB
Useful tip -- I never knew about that tool
the_mandrill
A: 

This problem is caused because Boost installation does not install threading libraries by default. You have to specifically select the threading libraries during installation. So, re-run the installation and select the threading library and select the version of your compiler to download appropriate files. In this case for file "'libboost_thread-vc90-mt-gd-1_42.lib" you need to select multi-threading for version VC++ compiler 9.0 debug with boost library version 1.42.

I hope this helps...

Prashant Nidgunde