Static Libraries / Multiply Defined Symbols

Using Visual Studio 2005, I have two independent static libraries making use of boost. When linking both into an executable I'm getting some multiply defined symbols. I suspect that since most of boost's implementation is header-only, symbols for the boost library functions are appearing in both libraries. I can get around this by specifying /FORCE:MULTIPLE when linking, but this isn't ideal. Is there a better way to get around this? Best Regards, Jeremy libNMRSD.lib(NMRSModule.obj) : error LNK2005: "public: __thiscall `bool __cdecl boost::interprocess::winapi::get_file_name_from_handle_function(void *,wchar_t *,unsigned int,unsigned int &)'::`7'::library_unloader::library_unloader(void *)" (??0library_unloader@?6??get_file_name_from_handle_function@winapi@interprocess@boost@@YA_NPAXPA_WIAAI@Z@QAE@0@Z) already defined in libDICOMTOOLSD.lib(Log.obj) libNMRSD.lib(NMRSModule.obj) : error LNK2005: "public: __thiscall `bool __cdecl boost::interprocess::winapi::get_file_name_from_handle_function(void *,wchar_t *,unsigned int,unsigned int &)'::`7'::library_unloader::~library_unloader(void)" (??1library_unloader@?6??get_file_name_from_handle_function@winapi@interprocess@boost@@YA_NPAXPA_WIAAI@Z@QAE@XZ) already defined in libDICOMTOOLSD.lib(Log.obj) libNMRSD.lib(NMRSModule.obj) : error LNK2005: "public: __thiscall `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`9'::handle_closer::handle_closer(void *)" (??0handle_closer@?8??unlink_file@winapi@interprocess@boost@@YA_NPBD@Z@QAE@PAX@Z) already defined in libDICOMTOOLSD.lib(Log.obj) libNMRSD.lib(NMRSModule.obj) : error LNK2005: "public: __thiscall `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`9'::handle_closer::~handle_closer(void)" (??1handle_closer@?8??unlink_file@winapi@interprocess@boost@@YA_NPBD@Z@QAE@XZ) already defined in libDICOMTOOLSD.lib(Log.obj) libNMRSD.lib(NMRSModule.obj) : error LNK2005: "public: __thiscall `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`11'::auto_ptr::auto_ptr(union `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`10'::mem_t *)" (??0auto_ptr@?L@??unlink_file@winapi@interprocess@boost@@YA_NPBD@Z@QAE@PATmem_t@?9??1234@YA_N0@Z@@Z) already defined in libDICOMTOOLSD.lib(Log.obj) libNMRSD.lib(NMRSModule.obj) : error LNK2005: "public: __thiscall `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`11'::auto_ptr::~auto_ptr(void)" (??1auto_ptr@?L@??unlink_file@winapi@interprocess@boost@@YA_NPBD@Z@QAE@XZ) already defined in libDICOMTOOLSD.lib(Log.obj) libNMRSD.lib(NMRSModule.obj) : error LNK2005: "public: union `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`10'::mem_t * __thiscall `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`11'::auto_ptr::get(void)const " (?get@auto_ptr@?L@??unlink_file@winapi@interprocess@boost@@YA_NPBD@Z@QBEPATmem_t@?9??2345@YA_N0@Z@XZ) already defined in libDICOMTOOLSD.lib(Log.obj) libNMRSD.lib(NMRSModule.obj) : error LNK2005: "public: union `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`10'::mem_t * __thiscall `bool __cdecl boost::interprocess::winapi::unlink_file(char const *)'::`11'::auto_ptr::operator->(void)const " (??Cauto_ptr@?L@??unlink_file@winapi@interprocess@boost@@YA_NPBD@Z@QBEPATmem_t@?9??1234@YA_N0@Z@XZ) already defined in libDICOMTOOLSD.lib(Log.obj) C:\home\jaudino\src\prs-removal\bin\translatorD.exe : fatal error LNK1169: one or more multiply defined symbols found Jeremy F. Audino Senior Software Development Engineer Philips Healthcare -- Nuclear Medicine Tel: 440-483-7444 E-mail: jeremy.audino@philips.com ________________________________ The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.

AMDG Audino, Jeremy wrote:
Using Visual Studio 2005, I have two independent static libraries making use of boost. When linking both into an executable I'm getting some multiply defined symbols. I suspect that since most of boost's implementation is header-only, symbols for the boost library functions are appearing in both libraries. I can get around this by specifying /FORCE:MULTIPLE when linking, but this isn't ideal. Is there a better way to get around this?
This is a bug in the compiler. The trunk contains a workaround. See https://svn.boost.org/trac/boost/ticket/2992 In Christ, Steven Watanabe

Steve, Thanks for your help! Exactly my issue. I'll wait for 1.40. -Jeremy Jeremy F. Audino Senior Software Development Engineer Philips Healthcare -- Nuclear Medicine Tel: 440-483-7444 E-mail: jeremy.audino@philips.com -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Steven Watanabe Sent: Wednesday, July 22, 2009 4:48 PM To: boost@lists.boost.org Subject: Re: [boost] Static Libraries / Multiply Defined Symbols AMDG Audino, Jeremy wrote:
Using Visual Studio 2005, I have two independent static libraries making use of boost. When linking both into an executable I'm getting some multiply defined symbols. I suspect that since most of boost's implementation is header-only, symbols for the boost library functions are appearing in both libraries. I can get around this by specifying /FORCE:MULTIPLE when linking, but this isn't ideal. Is there a better way to get around this?
This is a bug in the compiler. The trunk contains a workaround. See https://svn.boost.org/trac/boost/ticket/2992 In Christ, Steven Watanabe _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
participants (3)
-
Audino, Jeremy
-
k-oli@gmx.de
-
Steven Watanabe