STL template symbol "already defined in" errors ...

G

Gianni Mariani

I'm getting "multiply defined" errors on STL symbols. Isn't this a
linker error ? By definition, doesn't the compiler/linker need to
guarentee the "one definition rule".

Linking...

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 SyncTx.lib(SyncTr.obj)

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> >(char const *)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z)
already defined in SyncTx.lib(SyncTr.obj)

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> >(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 SyncTx.lib(SyncTr.obj)

.... lots o these cut

work.win32/NMFinger.exe : fatal error LNK1169: one or more multiply
defined symbols found
 
G

Guest

check project properties
C++
Code Generation
Runtime Library

ex (Multi-threaded Debug DLL (/MDd))

and make sure they are compatible bewteeen the projects in the solution
 
G

Gianni Mariani

jrainey said:
check project properties
C++
Code Generation
Runtime Library

ex (Multi-threaded Debug DLL (/MDd))

and make sure they are compatible bewteeen the projects in the solution

This turned out to be an ATL/MFC madness.

First I tried one suggestion to define _AFXDLL and that worked for one
binary but then it broke another binary.

So I'm now trying the "Use of MFC" and "Use of ATL" combinations.

The other problem confounding things is that I have a library from MS
(which I can't get compiled in different modes) that I think is build in
/MT (but it uses no system run times).
 

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