Fw: Problem linking to Boost Filesystem Library

I found the define BOOST_ALL_DYN_LINK in the config/auto-link headers which causes BOOST_FILESYSTEM_DECL to defined as __declspec(dllimport) and this solved the problem. However, I am not sure why it was necessary to set this define. The headers know that I am using VS2005 (they add vc80 to the library name) and that I am using dynamic libraries (doesn't insert the s in the name). Seems like it should be redundant information to have to define BOOST_ALL_DYN_LINK. Thanks, Doug Beatty ----- Forwarded by Douglas D. Beatty/MF Support/DST/US on 10/06/2008 04:31 PM ----- Douglas D. Beatty/MF Support/DST/US To boost-users@lists.boost.org 10/06/2008 03:15 cc PM Subject Problem linking to Boost Filesystem Library I am getting an unresolved external error when auto-linking to the Boost Filesystem Library Compiler: Visual Studio 2005 Boost Library Version: 1.36.0 The error: packagereport.obj : error LNK2001: unresolved external symbol "class boost::system::error_code boost::filesystem::detail::throws" (?throws@detail@filesystem@boost@@3Verror_code@system@3@A) The Boost Libraries were compiled using Visual Studio 2005 as well. I compiled with BOOST_LIB_DIAGNOSTIC and got the following two lines in the output: Linking to lib file: libboost_system-vc80-mt-gd-1_36.lib Linking to lib file: libboost_filesystem-vc80-mt-gd-1_36.lib I added /verbose to the linker and got the following: Processed /DEFAULTLIB:libboost_system-vc80-mt-gd-1_36.lib Processed /DEFAULTLIB:libboost_filesystem-vc80-mt-gd-1_36.lib Searching ..\3rdParty\Boost\lib\libboost_system-vc80-mt-gd-1_36.lib: Found "class boost::system::error_category const & __cdecl boost::system::get_system_category(void)" (?get_system_category@system@boost@@YAABVerror_category@12@XZ) Referenced in packagereport.obj Loaded libboost_system-vc80-mt-gd-1_36.lib(boost_system-vc80-mt-gd-1_36.dll) Found "class boost::system::error_category const & __cdecl boost::system::get_generic_category(void)" (?get_generic_category@system@boost@@YAABVerror_category@12@XZ) Referenced in packagereport.obj Loaded libboost_system-vc80-mt-gd-1_36.lib(boost_system-vc80-mt-gd-1_36.dll) Found __IMPORT_DESCRIPTOR_boost_system-vc80-mt-gd-1_36 Referenced in libboost_system-vc80-mt-gd-1_36.lib(boost_system-vc80-mt-gd-1_36.dll) Referenced in libboost_system-vc80-mt-gd-1_36.lib(boost_system-vc80-mt-gd-1_36.dll) Loaded libboost_system-vc80-mt-gd-1_36.lib(boost_system-vc80-mt-gd-1_36.dll) Found boost_system-vc80-mt-gd-1_36_NULL_THUNK_DATA Referenced in libboost_system-vc80-mt-gd-1_36.lib(boost_system-vc80-mt-gd-1_36.dll) Loaded libboost_system-vc80-mt-gd-1_36.lib(boost_system-vc80-mt-gd-1_36.dll) Searching ..\3rdParty\Boost\lib\libboost_filesystem-vc80-mt-gd-1_36.lib: Found "class boost::filesystem::file_status __cdecl boost::filesystem::detail::status_api(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class boost::system::error_code &)" (?status_api@detail@filesystem@boost@@YA?AVfile_status@23@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAVerror_code@system@3@@Z) Referenced in packagereport.obj Loaded libboost_filesystem-vc80-mt-gd-1_36.lib(boost_filesystem-vc80-mt-gd-1_36.dll) Found "class boost::system::error_code __cdecl boost::filesystem::detail::remove_api(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?remove_api@detail@filesystem@boost@@YA?AVerror_code@system@3@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) Referenced in packagereport.obj Loaded libboost_filesystem-vc80-mt-gd-1_36.lib(boost_filesystem-vc80-mt-gd-1_36.dll) Found __IMPORT_DESCRIPTOR_boost_filesystem-vc80-mt-gd-1_36 Referenced in libboost_filesystem-vc80-mt-gd-1_36.lib(boost_filesystem-vc80-mt-gd-1_36.dll) Referenced in libboost_filesystem-vc80-mt-gd-1_36.lib(boost_filesystem-vc80-mt-gd-1_36.dll) Loaded libboost_filesystem-vc80-mt-gd-1_36.lib(boost_filesystem-vc80-mt-gd-1_36.dll) Found boost_filesystem-vc80-mt-gd-1_36_NULL_THUNK_DATA Referenced in libboost_filesystem-vc80-mt-gd-1_36.lib(boost_filesystem-vc80-mt-gd-1_36.dll) Loaded libboost_filesystem-vc80-mt-gd-1_36.lib(boost_filesystem-vc80-mt-gd-1_36.dll) Using Dumpbin.exe I get the following:
From the dll:
68 43 00011E04 ?throws@detail@filesystem@boost@@3Verror_code@system@3@A
From the lib:
?throws@detail@filesystem@boost@@3Verror_code@system@3@A (class boost::system::error_code boost::filesystem::detail::throws) It looks like the decorated names in the lib and dll match the name that is being searched for by the linker and it looks like the linker found the lib file. Any ideas why this would not be linking? Also, I have tried disabling the auto-linking (using BOOST_ALL_NO_LIB) and linking manually, but I get the same error. Thanks, Doug Beatty ----------------------------------------- This e-mail and any attachments are intended only for the individual or company to which it is addressed and may contain information which is privileged, confidential and prohibited from disclosure or unauthorized use under applicable law. If you are not the intended recipient of this e-mail, you are hereby notified that any use, dissemination, or copying of this e-mail or the information contained in this e-mail is strictly prohibited by the sender. If you have received this transmission in error, please return the material received to the sender and delete all copies from your system.

AMDG DDBeatty@dstsystems.com wrote:
I found the define BOOST_ALL_DYN_LINK in the config/auto-link headers which causes BOOST_FILESYSTEM_DECL to defined as __declspec(dllimport) and this solved the problem.
However, I am not sure why it was necessary to set this define. The headers know that I am using VS2005 (they add vc80 to the library name) and that I am using dynamic libraries (doesn't insert the s in the name).
Seems like it should be redundant information to have to define BOOST_ALL_DYN_LINK.
This s indicates whether the library is built to link to the static C++ runtime library. In Christ, Steven Watanabe
participants (2)
-
DDBeatty@dstsystems.com
-
Steven Watanabe