Boost logo

Boost Users :

Subject: Re: [Boost-users] link error on boost example using binary library
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-09-15 01:37:27


N Z wrote:

> Hi there,
> I am a beginner using boost. I am installing boost 1.40 on
> windows XP with sp3 and Visual Studio Standard 2008. I followed the
> "Getting Started on Windows"  section 5.2   "Or, Simplified Build From
> Source. to build my binaries". i.e.
>
> bootstrap
> .\bjam
>
> I then tried to run the example in section 6:Link Your Program to a
> Boost Library.
> I got expected results when link from the IDE, however, I can't link
> under command prompt, here's the output I got when compiling:
> ******************************************************************************
> C:\Documents and Settings\Administrator\My Documents\Visual Studio
> 2008\Projects\boostBinaryLibExamp>cl /EHsc /I "c:\Program
> Files\boost\boost_1_40_0" boostBinaryLibExamp\boostBinaryLibExamp.cpp
> /link "c:\Program
> Files\boost\boost_1_40_0\stage\lib\libboost_regex-vc90-mt-1_40.lib"
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
> Copyright (C) Microsoft Corporation.  All rights reserved.
> boostBinaryLibExamp.cpp
> Microsoft (R) Incremental Linker Version 9.00.21022.08
> Copyright (C) Microsoft Corporation.  All rights reserved.
> /out:boostBinaryLibExamp.exe
> "c:\Program Files\boost\boost_1_40_0\stage\lib\libboost_regex-vc90-mt-1_40.lib"
> boostBinaryLibExamp.obj
> LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-s-1_40.lib'
> ******************************************************************************
>
> I searched in the lib directory, there's no such file there. But why I
> can link from IDE but not in command prompt?

Because IDE uses dynamic runtime by default. Seems like command line compiler
wants static runtime. You should probably pass /MD to the compiler. Also,
make sure "c:\Program Files\boost\boost_1_40_0\stage\lib\" is in libraries
search patch. (/LIBPATH)

- Volodya


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net