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

mots_g
  • 637
  • 8
  • 27

2 Answers2

3

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

smerlin
  • 6,446
  • 3
  • 35
  • 58
  • Is there a solution other than this? Somehow I feel it would not be safe to set this. Thanks – mots_g Jan 28 '10 at 12:29
  • 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 Jan 28 '10 at 15:39
  • 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 Jul 15 '10 at 05:43
2

The /NODEFAULTLIB switch could help aswell.

smerlin
  • 6,446
  • 3
  • 35
  • 58