Question

The below error list pops up. I am okay if this had happened on Release build.

It is quite surprising that it has happened in DEBUG build.

1>libcmtd.lib(dbgheap.obj) : error LNK2005: malloc already defined in libcmt.lib(malloc.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _heap_alloc already defined in libcmt.lib(malloc.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: calloc already defined in libcmt.lib(calloc.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: realloc already defined in libcmt.lib(realloc.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _recalloc already defined in libcmt.lib(realloc.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _expand already defined in libcmt.lib(expand.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: free already defined in libcmt.lib(free.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _msize already defined in libcmt.lib(msize.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _aligned_malloc already defined in libcmt.lib(align.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _aligned_realloc already defined in libcmt.lib(align.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _aligned_recalloc already defined in libcmt.lib(align.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _aligned_offset_malloc already defined in libcmt.lib(align.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _aligned_offset_realloc already defined in libcmt.lib(align.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _aligned_offset_recalloc already defined in libcmt.lib(align.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _aligned_free already defined in libcmt.lib(align.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: _aligned_msize already defined in libcmt.lib(align.obj)
1>libcmtd.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in libcmt.lib(dbghook.obj)
1>libcmtd.lib(isctype.obj) : error LNK2005: _isctype_l already defined in libcmt.lib(isctype.obj)
1>libcmtd.lib(isctype.obj) : error LNK2005: _isctype already defined in libcmt.lib(isctype.obj)

Était-ce utile?

La solution

It looks like you're linking to the Debug runtime as well as the Release runtime - probably you have a Release build that links statically to a Debug lib or vice versa.

Autres conseils

  • If your application use any LIBs or DLLs any of those are statically link with run-time assemblies. that's the reason for this linking error.
  • Run-time assemblies statically liking is not a recommended method

  • But if you need to get rid from this linking error here you go, right-click on project file in project explorer -> properties -> configuration properties -> linker -> Input -> Ignore Specific Library -> add libcmtd.lib

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top