470,647 Members | 1,115 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

problem with multiple symbols when using a static lib

Hi,

i am using a third party static library (.lib) that wraps a class interface
around an old C-style dll. in the static library they use the STL for some
stuff i don't know about.

in my own code, i also use the STL, for basic_string for example.

at link time, i get a lot of errors like:
msvcprtd.lib(MSVCP71D.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?$alloc ator@D@2@@std@@QAE@XZ)
already defined in ErrorHandling.obj
ErrorHandling.obj is the object file for the source file that contains my
errorhandling code. There is some basic_string stuff in there.

i can work around this by using /FORCE:MULTIPLE but this looks inelegant and
also gives lots of warnings. another way is to set project C++ options for
using runtime libraries in a dll instead of static. this works but i guess
this will only work if i don't have to link against multiple statis libs
that use the same functionality.

is there a better way to handle this problem?

kind regards and happy newyear to all of you,
Bruno.
Nov 17 '05 #1
1 1002
Hello Bruno,

It is likely because your project uses the MSVC runtime library dynamically.
That is, it uses the DLL version of the MS runtime library.

Try changing your project options to using the static version of the MS
runtime lib.

- Bio.

"Bruno van Dooren" wrote:
Hi,

i am using a third party static library (.lib) that wraps a class interface
around an old C-style dll. in the static library they use the STL for some
stuff i don't know about.

in my own code, i also use the STL, for basic_string for example.

at link time, i get a lot of errors like:
msvcprtd.lib(MSVCP71D.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?$alloc ator@D@2@@std@@QAE@XZ)
already defined in ErrorHandling.obj
ErrorHandling.obj is the object file for the source file that contains my
errorhandling code. There is some basic_string stuff in there.

i can work around this by using /FORCE:MULTIPLE but this looks inelegant and
also gives lots of warnings. another way is to set project C++ options for
using runtime libraries in a dll instead of static. this works but i guess
this will only work if i don't have to link against multiple statis libs
that use the same functionality.

is there a better way to handle this problem?

kind regards and happy newyear to all of you,
Bruno.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

68 posts views Thread by Marco Bubke | last post: by
7 posts views Thread by Torbak | last post: by
1 post views Thread by Torbak | last post: by
7 posts views Thread by Ittay Dror | last post: by
3 posts views Thread by ozzyfb | last post: by
2 posts views Thread by Jeff | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.