Subject: Re: [Boost-users] Auto-Linking in Visual Studio 2008
From: John Drescher (drescherjm_at_[hidden])
Date: 2012-01-03 16:33:28


> I recently began using boost in a project on Windows using MS Visual Studio
> 9.0 2008 using CMake, i.e. the project setup is auto-generated using the
> correct boost libraries as link targets. In my project, I link to
> boost_thread*.lib, which should be the import library for boost_thread*.dll.
>
> However, when I compile the project, the I get the following linking error:
>
> Error    43    fatal error LNK1104: cannot open file
> 'libboost_thread-vc90-mt-1_48.lib'    rsb-chat-1    rsb-chat-1
>
>
> So it seems necessary to have the static library present as well when
> linking the executable. At first I thought this was the default auto-linking
> behavior described in the documentation, i.e. static linking. However, once
> all needed static libraries are supplied, the final executable still needs
> the dynamic boost_*.dll libraries. This did not seem right to me...
>

When using .dlls in this way the .lib is needed and is called an
import library. Linking against an import library does not remove you
from needing the .dll.

John