B
Bruce
I am getting a lot of link errors when compiling in the debug build but
not release. I am compiling a CLR managed code class library.
I believe the link errors are actually being caused by a static library
of unmanagaed code.
I think the problem comes from the fact that the unmanaged static lib
uses the STL. Any idea how to fix this?
Below are the errors:
libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall
std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in
msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall
std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined
in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xdebug.obj) : error LNK2005: "void * __cdecl operator
new[](unsigned int,struct std::_DebugHeapTag_t const &,char *,int)"
(??_U@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) already defined in
msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xdebug.obj) : error LNK2005: "struct std::_DebugHeapTag_t
const & __cdecl std::_DebugHeapTag_func(void)"
(?_DebugHeapTag_func@std@@YAABU_DebugHeapTag_t@1@XZ) already defined in
msvcprtd.lib(MSVCP80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall
std::exception::exception(void)" (??0exception@std@@QAE@XZ) already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall
std::exception::exception(char const * const &)"
(??0exception@std@@QAE@ABQBD@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall
std::exception::exception(class std::exception const &)"
(??0exception@std@@QAE@ABV01@@Z) already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall
std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const *
__thiscall std::exception::what(void)const "
(?what@exception@std@@UBEPBDXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __malloc_dbg already defined
in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __free_dbg already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined
in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encoded_null already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)"
(?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already
defined in MSVCRTD.lib(MSVCR80D.dll)
Creating library D:\Data\GarXfaceNET\bin\GarXfaceNet.lib and object
D:\Data\GarXfaceNET\bin\GarXfaceNet.exp
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other
libs; use /NODEFAULTLIB:library
not release. I am compiling a CLR managed code class library.
I believe the link errors are actually being caused by a static library
of unmanagaed code.
I think the problem comes from the fact that the unmanaged static lib
uses the STL. Any idea how to fix this?
Below are the errors:
libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall
std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in
msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall
std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined
in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xdebug.obj) : error LNK2005: "void * __cdecl operator
new[](unsigned int,struct std::_DebugHeapTag_t const &,char *,int)"
(??_U@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) already defined in
msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xdebug.obj) : error LNK2005: "struct std::_DebugHeapTag_t
const & __cdecl std::_DebugHeapTag_func(void)"
(?_DebugHeapTag_func@std@@YAABU_DebugHeapTag_t@1@XZ) already defined in
msvcprtd.lib(MSVCP80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall
std::exception::exception(void)" (??0exception@std@@QAE@XZ) already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall
std::exception::exception(char const * const &)"
(??0exception@std@@QAE@ABQBD@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall
std::exception::exception(class std::exception const &)"
(??0exception@std@@QAE@ABV01@@Z) already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall
std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const *
__thiscall std::exception::what(void)const "
(?what@exception@std@@UBEPBDXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __malloc_dbg already defined
in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __free_dbg already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined
in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encoded_null already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)"
(?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter already
defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already
defined in MSVCRTD.lib(MSVCR80D.dll)
Creating library D:\Data\GarXfaceNET\bin\GarXfaceNet.lib and object
D:\Data\GarXfaceNET\bin\GarXfaceNet.exp
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other
libs; use /NODEFAULTLIB:library