Boost logo

Boost Users :

Subject: [Boost-users] Fw: Problem linking to Boost Filesystem Library
From: DDBeatty_at_[hidden]
Date: 2008-10-06 17:37:17


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_at_[hidden]
             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_at_detail@filesystem_at_boost@@3Verror_code_at_system@3_at_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_at_system@boost@@YAABVerror_category_at_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_at_system@boost@@YAABVerror_category_at_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_at_detail@filesystem_at_boost@@YA?AVfile_status_at_23@ABV?$basic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_D@2@@std@@AAVerror_code_at_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_at_detail@filesystem_at_boost@@YA?AVerror_code_at_system@3_at_ABV?$basic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_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_at_detail@filesystem_at_boost@@3Verror_code_at_system@3_at_A

>From the lib:

                  ?throws_at_detail@filesystem_at_boost@@3Verror_code_at_system@3_at_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.


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