views:

1045

answers:

2

Here is My scenario. I have a project which contains 30 subprojects. In one of the projects I have used CLR (common language runtime) so I modified its runtime with /mdd (multi threaded debug DLL).

Individually all the projects are built successfully. But when I try to compile the main project I am getting the following linker errors:

LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library


LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
LIBCMTD.lib(fclose.obj) : error LNK2005: _fclose already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(printf.obj) : error LNK2005: _printf already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(mbstowcs.obj) : error LNK2005: _mbstowcs already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(wcstombs.obj) : error LNK2005: _wcstombs already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tzset.obj) : error LNK2005: __tzset already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stricmp.obj) : error LNK2005: __stricmp already defined in MSVCRTD.lib(MSVCR80D.dll)

How to resolve these all?

+3  A: 

Seems like some of your projects use static runtime library. (And you have chosen dynamic for one of your projects) This combination is unsupported.

Reminds me of: http://stackoverflow.com/questions/604484/linker-errors-between-multiple-projects-in-visual-c

EFraim
A: 

LIBCMTD is the debug version of the static multi-threaded C runtime library. MSVCR80D is a debug version of the DLL-based multi-threaded C runtime library. Some of your sub-projects are calling for one, some the other. It's a Microsoft mess, but you have to deal with it. Pick one, say, Multi-threaded debug DLL, and use it exclusively for the Debug version of your project and all sub-projects. The Microsoft license (I am told) requires that you use a non-debug version for released software.

See the following for more info: CLICK.

alt text

Jive Dadson
P.s. When you convert everything to a single version of the C runtime (CRT), do a project "clean" and "rebuild" on every project separately.
Jive Dadson