Boost logo

Boost :

Subject: [boost] Static Libraries / Multiply Defined Symbols
From: Audino, Jeremy (jeremy.audino_at_[hidden])
Date: 2009-07-22 11:38:43


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_at_winapi@interprocess_at_boost@@YA_NPAXPA_WIAAI_at_Z@QAE_at_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_at_winapi@interprocess_at_boost@@YA_NPAXPA_WIAAI_at_Z@QAE_at_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_at_winapi@interprocess_at_boost@@YA_NPBD_at_Z@QAE_at_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_at_winapi@interprocess_at_boost@@YA_NPBD_at_Z@QAE_at_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_at_winapi@interprocess_at_boost@@YA_NPBD_at_Z@QAE_at_PATmem_t@?9??1234_at_YA_N0_at_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_at_winapi@interprocess_at_boost@@YA_NPBD_at_Z@QAE_at_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_at_auto_ptr@?L@??unlink_file_at_winapi@interprocess_at_boost@@YA_NPBD_at_Z@QBEPATmem_t@?9??2345_at_YA_N0_at_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_at_winapi@interprocess_at_boost@@YA_NPBD_at_Z@QBEPATmem_t@?9??1234_at_YA_N0_at_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_at_[hidden]

________________________________
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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk