C++ 2008 Express - Problem Linking

Hey all. Sorry to add another one of these posts to the forum. I've done a fair bit of searching and can't find the answer to my problem. I'm using VC++ 2008 Express.

I'm trying to link with an external DLL. I've added the corresponding .lib file (boost_thread-vc90-mt-gd-1_47.lib) to the 'Additional Dependencies'. As well as adding the library directory ("C:\Program Files\boost\boost_1_47\lib") to 'Additional Library Directories'. However, when I go to compile I get this error:

 
1>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_47.lib'


Why is it adding 'lib' to the library name I specified?

Thanks.

Nick.
Last edited on
When compiled with VC++, Boost headers ask the compiler to link to the correct library by themselves; you don't need to do it manually.
That is the name the library should have. Did you compile from source, or did you download binaries?
Hey helios, thanks for the quick reply! I downloaded the binaries from BoostPro. I chose the Multithreaded DLL and Debug Multithreaded DLL variants.

I undid all of the stuff I did. First time round it complained because it couldn't find the header files... so now I'll add that back to the VC++ Include Directories.

Second time round: LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_47.lib'

So same error. There must be a PATH variable or something I've stuffed up. Any ideas?

Thanks heaps.

Nick.
Actually, it is still looking for the wrong file. Did I need to choose different variants or something? I'm pretty sure the static variants would have filenames like the one it is looking for.

Nick.
Well, there's three possibilities:
1. You're not quoting the path to the lib directory, so the space in "Program Files" is confusing the compiler.
2. You didn't download the correct versions. See if you have a file that matches the glob "*boost_thread-vc90-mt-gd-1_47.lib".
3. For some reason, the installer didn't produce all the required library files. It should have put one that begins with "boost_thread-...", then copy it into another that begins with "libboost_thread-...". If you have one version, but not the other, you can simply copy it.

I would suggest getting sources and building them yourself, though. It's really easy to do with VC++:
1. Get them from http://sourceforge.net/projects/boost/files/boost/1.47.0/
2. After extracting, run the Visual Studio command prompt (I don't remember if the Express version has that, but I believe it should) and navigate to where it extracted.
3. Run:
bootstrap
bjam --build-type=complete

This will build all possible combinations of runtime libraries. It will take about half an hour.
Ok, the 3rd possibility is what is happening. I'm just a little confused.

From what I've read today, I was under the impression that .lib files that begin with 'lib' are static libraries, and .lib files that don't lead with 'lib' are import libraries (at least these are standard naming conventions).

So, I guess the question becomes -> if I do a complete build, how will I tell the compiler which version of the libraries I want to use? Static vs dynamically linked?

Thanks again (sorry about all the questions), Nick.
Last edited on
From what I've read today, I was under the impression that .lib files that begin with 'lib' are static libraries, and .lib files that don't lead with 'lib' are import libraries (at least these are standard naming conventions).
Actually, yeah. You're right. I was thinking of something else:
>md5sum libboost_thread-vc90-mt*
b8edb9059753b0f5e1cf809976c46555 *libboost_thread-vc90-mt-1_46_1.lib
b8edb9059753b0f5e1cf809976c46555 *libboost_thread-vc90-mt.lib


if I do a complete build, how will I tell the compiler which version of the libraries I want to use? Static vs dynamically linked?
Read this (second answer, about <boost/config/user.hpp>): http://stackoverflow.com/questions/2520234/how-to-link-to-dynamic-boost-libs
You might want to try this before building from source.
Topic archived. No new replies allowed.