views:

135

answers:

2

I am building my application in Visual Studio 2005, using project properties ->c/c++->CodeGeneration->RuntimeLib: MTd (using static CRT library-LIBCMTD). The application is using 3rd party dlls and libs which are built in MDd(using dynamic CRT lib- MSVCRTD).

I'm getting linker errors as: MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: __mktime64 already defined in LIBCMTD.lib(mktime64.obj) MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: __gmtime64 already defined in LIBCMTD.lib(gmtime64.obj) MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: __localtime64 already defined in LIBCMTD.lib(loctim64.obj)

I cannot change the 3rd party settings. My application runs fine if I use the CRT lib dynamically, but I cannot change this.

Thanks

+3  A: 

There is a switch to force the linker to ignore multiple definitions: http://msdn.microsoft.com/en-us/library/70abkas3.aspx

smerlin
Is there a solution other than this? Somehow I feel it would not be safe to set this.Thanks
mots_g
Could be... but thats the only one i know. If you go with this, it would be probably best to do a build without this switch before you build an release version to check if there are any other (probably unwanted) multiple definitions beside those of the CRT library
smerlin
This is extremely valuable! I've been fighting it for almost a week and I didn't know about this switch. Thank you!(Yes, I'm aware that it's probably a quick hack, but that's what I want)
kizzx2
+1  A: 

The /NODEFAULTLIB switch could help aswell.

smerlin