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

  • Thread starter Thread starter Gianni Mariani
  • Start date Start date
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
 
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
 
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).
 
Back
Top