Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-05-27 12:29:15


Rob Agar wrote:
> hi all,
>
> Apologies if this question has been asked a million times before, but
> having searched the archives and documentation I'm none the wiser.
>
> Basically the problem is this: the auto-linker is trying to link to
> the wrong boost::filesystem lib and I can't figure out out to fix it.
>
> The error from MS Visual Studio 2005 is "LINK : fatal error LNK1104:
> cannot open file 'libboost_filesystem-vc80-mt-gd-1_34.lib'". Fair
> enough because this file does not exist.
>
> I want it to use the dll import lib
> boost_filesystem-vc80-mt-gd-1_34.lib. This file does exist, and is in
> a directory on the MSVC lib search path, along with the matching dll.
>
> So the question is, how do I tell the auto-linker to link to the file
> I want, or if this is not possible, how do I switch off auto-linking?

It defaults to linking against a static library by default, to link to the
dll version you will need to build your application with either of the
following defined:

BOOST_FILESYSTEM_DYN_LINK: only Boost.Filesystem will be linked to the dll.
BOOST_ALL_DYN_LINK: all boost libraries will link to the dll version.

Other macros you may want to know about:

BOOST_FILESYSTEM_NO_LIB: turns off auto-linking for Boost.Filesystem.
BOOST_ALL_NO_LIB: turns off auto-linking for everything.

But even if you use these last two, you still need to know about the first
two to persuade the headers to mark the code as __declspec(dllimport).

HTH, John.


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