Linker problem with boost libraries and visual studio 2008

Posted on 2009-04-21
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
    LVL 1

    Accepted 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.

    LVL 1

    Expert Comment

    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.
    LVL 4

    Author Closing Comment

    Thank you very very much
    LVL 4

    Author Comment

    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

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
    In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now