
Hello, when the run boost test cases (Version 1.41.0), I got quite a few LNK2005 errors. Below is an example when run a Data_Time test: msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in dates_as_strings.obj msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in dates_as_strings.obj It seems to me that there is a conflict between system library and the Boost library, but I am not sure if this is a bug or the Boost library is not correctly built. Any clue would be very appreciated. Best regards, --Kevin _________________________________________________________________

On 13.01.2010 21:38, Kevin Li wrote:
Hello, when the run boost test cases (Version 1.41.0), I got quite a few LNK2005 errors. Below is an example when run a Data_Time test:
It seems to me that there is a conflict between system library and the Boost library, but I am not sure if this is a bug or the Boost library is not correctly built. Any clue would be very appreciated.
I guess that the library was build with static CRT and the executable with the shared one. Make sure you pass runtime-link=shared to bjam at all times.

Thanks for the reply. The problem has been fixed by adding /FORCE:MULTIPLE to the linking flag. --Kevin
Date: Thu, 14 Jan 2010 21:10:57 +0300 From: andrey.semashev@gmail.com To: boost@lists.boost.org Subject: Re: [boost] error LNK2005
On 13.01.2010 21:38, Kevin Li wrote:
Hello, when the run boost test cases (Version 1.41.0), I got quite a few LNK2005 errors. Below is an example when run a Data_Time test:
It seems to me that there is a conflict between system library and the Boost library, but I am not sure if this is a bug or the Boost library is not correctly built. Any clue would be very appreciated.
I guess that the library was build with static CRT and the executable with the shared one. Make sure you pass runtime-link=shared to bjam at all times. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_________________________________________________________________ Say Happy New Year with Messenger for Mobile. http://go.microsoft.com/?linkid=9706117

You've fixed the Link error, but you haven't fixed your problem. The documentation for /FORCE:MULTIPLE says: "A file created with this option may not run as expected.". What you've done in the link equivilent of using reinterpret_cast to silence compiler errors - the linker is telling you there's an error and, instead of fixing the error, you're telling the linker to ignore it.

You're right. After I added /FORCE:MULTIPLE, the error message became warning message, I have also noticed the warning "image may not run as expected". However, the test runs without any problem. I am not sure if this is okay. Does anyone knows how to fix the real problem there? Thanks, --Kevin
Date: Wed, 20 Jan 2010 17:16:09 +0000 From: joseph.gauterin@googlemail.com To: boost@lists.boost.org Subject: Re: [boost] error LNK2005
You've fixed the Link error, but you haven't fixed your problem. The documentation for /FORCE:MULTIPLE says: "A file created with this option may not run as expected.".
What you've done in the link equivilent of using reinterpret_cast to silence compiler errors - the linker is telling you there's an error and, instead of fixing the error, you're telling the linker to ignore it. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_________________________________________________________________

You need to build boost against the same version of the C++ runtime as you're building your code. You're probably building one against the static runtime and one against the dynamic runtime.
participants (3)
-
Andrey Semashev
-
Joseph Gauterin
-
Kevin Li