For Programmers: Free Programming Magazines  


Home > Archive > VC STL > April 2005 > RE: Linking libs using STL gives LNK2005 (multiple definition of symbo









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: Linking libs using STL gives LNK2005 (multiple definition of symbo
mr_incredible

2005-04-11, 4:00 am

Hi Joerg,

I wish I could help you, but instead I am joining you in the quest for help!
I have the very same issue, and I'm not even migrating to 7.1 for crying out
loud!

I have a VC 6.0 project (which must remain at 6.0 for a while) and I have
the same issue. The linker mistakenly thinks I have somehow redefined the
string template, but I have done no such thing. If I remove references to the
string, it stops complaining. Sounds like a bug to me...

"Jörg Zieren" wrote:

> Hi,
>
> in a project I am currently trying to migrate from 6.0 to 7.1, I get
> numerious LNK2005 errors in 7.1 complaining about multiple definitions of
> several STL elements:
>
> error LNK2005: "public: __thiscall std::map<class std::basic_string<...
> error LNK2005: "protected: static struct std::pair<class std::basic_string<...
> ....
>
> I am trying to build a lib that depends on several other libs that are
> linked with the below command line (i.e. ignoring libcmtd.lib and
> libcpmtd.lib). The above symbols are said to have been defined in the
> objects files of one of the libs that gets linked with the lib currently
> being built.
>
> /OUT:".\../../#Debug/modules_common.dll" /INCREMENTAL:NO /NOLOGO
> /LIBPATH:"..\\" /LIBPATH:"L:\ltilib\lib" /LIBPATH:"L:\ltilib\win\lib" /DLL
> /NODEFAULTLIB:"libcmtd.lib" /NODEFAULTLIB:"libcpmtd.lib" /DEBUG
> /PDB:".\../../#Debug/modules_common.pdb"
> /IMPLIB:".\../../#Debug/modules_common.lib" /MACHINE:X86 ltilib7_dmfcd.lib
> "\tmp\ugNet\unifiedGesture\#Debug\lib_ug.lib"
> \tmp\ugNet\unifiedGesture\lib\pch.lib
> "\tmp\ugNet\unifiedGesture\#Debug\lib_fx.lib"
> " \tmp\ugNet\unifiedGesture\#Debug\lib_htm
l.lib"
>
> Does anyone have an idea what causes this error, and how to fix it? Do I
> have to ignore more libraries besides libcmtd.lib and libcpmtd.lib?
>
> Any help greatly appreciated!
>
> -Joerg
>

Carl Daniel [VC++ MVP]

2005-04-11, 4:00 am

mr_incredible wrote:
> Hi Joerg,
>
> I wish I could help you, but instead I am joining you in the quest
> for help!
> I have the very same issue, and I'm not even migrating to 7.1 for
> crying out loud!
>
> I have a VC 6.0 project (which must remain at 6.0 for a while) and I
> have
> the same issue. The linker mistakenly thinks I have somehow redefined
> the string template, but I have done no such thing. If I remove
> references to the string, it stops complaining. Sounds like a bug to
> me...


Check your compiler "code generation" settings. You probably have a mixture
of static and DLL runtime libraries selected (checked everything that goes
into the link).

-cd


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com