Linker problem with boost libraries and visual studio 2008

Posted on 2009-04-21
Medium Priority
Last Modified: 2013-12-17
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?
Question by:The_King
  • 2
  • 2

Accepted Solution

maartennieber earned 2000 total points
ID: 24200452
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.


Expert Comment

ID: 24204728
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.

Author Closing Comment

ID: 31573035
Thank you very very much

Author Comment

ID: 24207987
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!

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever run into that annoying problem where the computer won't boot?  Wouldn't it be great if you had a tool that would make that disk boot again?  I have found one tool that works more often than not ...
Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question