[regex] Link problem with VC8 regex build

Hi, I have built the regex library as per instructions, using a command prompt set up by Visual Studio. When I come to build my project using the library, it automaticaly pulls in the regex lib file, but I get multiple defined symbols from the linker: Linking... libboost_regex-vc80-mt-gd-1_33_1.lib(usinstances.obj) : error LNK2005: "public: static unsigned int __cdecl std::char_traits<unsigned short>::length(unsigned short const *)" (?length@?$char_traits@G@std@@SAIPBG@Z) already defined in msvcprtd.lib(MSVCP80D.dll) libboost_regex-vc80-mt-gd-1_33_1.lib(usinstances.obj) : error LNK2005: "public: __thiscall std::allocator<unsigned short>::allocator<unsigned short>(void)" (??0?$allocator@G@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP80D.dll) My app is built with wchar_t as unsigned short, and with UNICODE and _UNICODE defined, so I updated the makefile for this and rebuilt, but I just get the same thing. I can't even see how usinstances.cpp or any other file defines these things, and searching boost and the web reveals nothing. Any ideas, anyone? Thanks, Simon

simon.sebright@ubs.com wrote:
Hi,
I have built the regex library as per instructions, using a command prompt set up by Visual Studio. When I come to build my project using the library, it automaticaly pulls in the regex lib file, but I get multiple defined symbols from the linker:
My app is built with wchar_t as unsigned short, and with UNICODE and _UNICODE defined, so I updated the makefile for this and rebuilt, but I just get the same thing.
I can't even see how usinstances.cpp or any other file defines these things, and searching boost and the web reveals nothing. Any ideas, anyone?
It's known issue: http://sourceforge.net/tracker/index.php?func=detail&aid=1470041&group_id=7586&atid=107586 The easiest workaround is to build the regex lib with /Zc:wchar_t- HTH, John.

Hi,
I have built the regex library as per instructions, using a command prompt set up by Visual Studio. When I come to build my
simon.sebright@ubs.com wrote: project using
the library, it automaticaly pulls in the regex lib file, but I get multiple defined symbols from the linker:
My app is built with wchar_t as unsigned short, and with UNICODE and _UNICODE defined, so I updated the makefile for this and rebuilt, but I just get the same thing.
I can't even see how usinstances.cpp or any other file defines these things, and searching boost and the web reveals nothing. Any ideas, anyone?
It's known issue: http://sourceforge.net/tracker/index.php?func=detail&aid=14700 41&group_id=7586&atid=107586
The easiest workaround is to build the regex lib with /Zc:wchar_t-
HTH, John.
Thanks, just compiling with /Zc:wchar_t- didn't help in my case, however I noticed that one message in the above thread indicated to add template<> _CRTIMP2 std::size_t __cdecl char_traits<unsigned short>::length(unsigned short const*); This brought the linker errors down to just one, so in a similar fashion, I added: template<> __thiscall std::allocator<unsigned short>::allocator(void); Which enabled me to build my project successfully. Regards, Simon
participants (2)
-
John Maddock
-
simon.sebright@ubs.com