• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1564
  • Last Modified:

Linker problem with boost libraries and visual studio 2008

I am running XP SP3, and I have visual studio 2008 installed. It has been updated to SP1 and I have also installed the SDK.

I am trying to get the boost libraries up and going but seem to be encountering difficulties.

I have compiled ALL the boost libraries using BJAM for msvc using complete and stage keywords and it took hours but built ALL the libraries.

I have added the paths to the libraries / headers into visual studio options for C++ directories.

However whenever I try to use them I get the following linker error.

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

I can manually locate the file in \bin.v2\libs\regex\build\msvc-9.0\debug\link-static\threading-multi\

But whatever I try I cannot get Visual C++ to open it and link to it.

Can Anyone help?
  • 2
  • 2
1 Solution
1. copy this library to a much smaller path (you never know, the long path name might be a problem), for example D:\Test\libboost_regex-vc90-mt-gd-1_38.lib

2. in the Linker settings, specify the full path to this lib (D:\Test\libboost_regex-vc90-mt-gd-1_38.lib) in the field where you place the libraries to link against. Normally, you would put library names and library path separately in the project settings, but now you just want to know what causes the problem

3. If visual studio complains that D:\Test\libboost_regex-vc90-mt-gd-1_38.lib cannot be found, then I will have to give up... If it now works, you can try splitting D:\Test\libboost_regex-vc90-mt-gd-1_38.lib into a path (D:\Test) and library (libboost_regex-vc90-mt-gd-1_38.lib). Add the path to the library input path in the linker tab of the project settings. Check if it still works.

4. Finally, you can try to specify the full path name to the original location of the boost library.

I hope these steps will generate some further clues as to what is happening.

By the way, you should try the above in a new project containing a single source file that just prints something to the screen. This simple application should not include a boost header. Including a boost header triggers an automatic mechanism that tells visual studio to link with the corresponding boost library. It is better to simplify things as much as possible at first, and just see if we can directly link with the library or not.
The_KingAuthor Commented:
Thank you very very much
The_KingAuthor Commented:
I copied the library to d:\ so the path was as short as possible.

Added d:\ to the libraries in visual studio

worked fine.

I should have thought of this but after hours of messing sometimes it takes a fresh pair of eyes.

Thanks you very much for your help!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now