views:

192

answers:

1

Hi

Here is My Scenario.

I have an Existing Solution in visualstudio which contains 15 projects.

in some project i need to use managed c++ extensions. So first i have a workaround for sample solution contains 4 projects in those i have maintained dependencies b/w them.

and my solution is builded also.

I apply the same procedure to existing solution by adding extra project which contains managed code.so that i enable CLR in calling project(from where i call new added project methods from existing ex:demoproj) as well as project which contains main().and change the runtime from /mtd(existing one contains /mtd) to /mdd.

when i build the demoproj it builds success fully. But when i building project which contains main() it gives lot of errors like

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)


I found this is happend because of using /clr option i think any idea???

But this case is not happend for my test solution.How to resolve this

Any help is greatly appreciated

+1  A: 

All the dlls you link to using import libraries must have the same setting as the application for how you link to the runtime library. The errors are showing that you are mixing use of the runtime as a .dll (MSVCRTD) and as a .lib (LIBCMTD).

James Hopkin