problem with multiple symbols when using a static lib

  • Thread starter Bruno van Dooren
  • Start date
B

Bruno van Dooren

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?$allocator@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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top