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? I would rather not recompile the boost libs if I can help it. Thanks Rob
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.
It's trying to use the static lib instead of the dynamic one. The usual cause of this is that you are using the static C++ runtime instead of the dynamic one. Check your project settings.
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?
Well I can't point you at the docs explaining this as we had them... All I can point now is http://www.boost.org/libs/config/config.htm#user_settable. And scroll down to the *DYN_LINK and *NO_LIB settings.
I would rather not recompile the boost libs if I can help it.
AFAIK doing the regular Boost compile produces the static libraries. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo
Rene Rivera wrote:
It's trying to use the static lib instead of the dynamic one. The usual cause of this is that you are using the static C++ runtime instead of the dynamic one. Check your project settings.
Nope, definitely using the multithreaded dll runtime (as intended). Perhaps this is a bug in the auto linker on windows?
Well I can't point you at the docs explaining this as we had them... All I can point now is http://www.boost.org/libs/config/config.htm#user_settable. And scroll down to the *DYN_LINK and *NO_LIB settings.
Thanks, #define BOOST_FILESYSTEM_DYN_LINK does the trick. But given the fundamental nature of the problem, it seems to me that this page needs to be rather more prominent than it is. The link to it on the boost site is lost in the list of libraries. And it's marked "not intended for library users". Not helpful.
AFAIK doing the regular Boost compile produces the static libraries.
I'm using the compiled binaries downloaded from http://www.boost-consulting.com/products/free, which only includes dynamically linked versions. I don't remember choosing between static and dynamic linking when installing it. Anyway, thank you very much for your help Rene. Rob
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.
John Maddock wrote:
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.
Thanks John, BOOST_FILESYSTEM_DYN_LINK is just what I needed. These config settings definitely need a prominent mention in the filesystem and boost common docs. Rob
participants (3)
-
John Maddock
-
Rene Rivera
-
Rob Agar