Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linker problems

Status
Not open for further replies.

Brewman76

Programmer
Joined
Mar 27, 2001
Messages
50
Location
US
After a few years away from C++ I am stepping back into the VC waters head first and eyes closed :-)

I am linking into my project two static libraries that were obtained from a 3rd party. When compiling the program I am getting the following linker errors & warnings:

msvcprtd.lib(MSVCP60D.dll) : error LNK2005: &quot;public: class std::basic_string <blah blah snip> already defined in OrderCache.lib(OrderCache.obj)
(I get 8 of these errors, all are pretty much the same)

Then it says:
default lib &quot;LIBCMTD&quot; conflicts with use of other libs; use /NODEFAULTLIB:library

OrderCache is the 3rd party static lib.

Here's the kicker:
Using my new best friend google.com I found information about changing the runtime library to use &quot;Debug Multithreaded DLL&quot; which did take away some of the linker errors I was having before. I also found information about using the Ignore Libraries line on the Linker tab and LIBCMTD.LIB is already declared in this line. So why is it still insisting on linking to this library? I also included msvcprtd.lib in the ignore lines (based on the errors above) but I still get the errors.

This is an ATL project, I am attempting to make this into a COM DLL. Could the 3rd party lib be built in a way that it doesn't work inside a COM dll? I'm not exposing any of the library's functionality.

Any ideas?

Thanks!
 
A followup:

OK, maybe this will help someone figure out what's going on.

I checked on the &quot;Ignore All Default Libraries&quot; and included in the &quot;Object/Library Modules&quot; line msvcrtd.lib and msvcprtd.lib.

I get eight of these errors:

msvcprtd.lib(msvcp60d.dll) : error LNK 2005: &quot;public class std::basic_string <SNIP SNIP> already defined in OrderCache.lib(OrderCache.obj)

If it makes any difference the error messages seem to be refering to overloaded operators.

Then the last error message is:
fatal error LNK 1169: one or more multiply defined symbols found

Now, if I remove msvcprtd.lib from the &quot;Object/Library Modules&quot; line and recompile, I then get a boatload of unresolved externals in OrderCache.lib. So the connundrum to my linker newbie mind seems to be that OrderCache.lib has something that conflicts with msvcprtd.lib yet it can't live without it.

Anyone? Please? Help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top