链接到多线程调试DLL库时链接错误

时间:2013-05-16 12:06:15

标签: c++ visual-studio-2008 visual-c++

我正在尝试将空项目与PoDoFo库(.lib)链接,使用带有 多线程调试DLL(/ MDd) 的VS项目构建库>集。 当我尝试在另一个项目中与该lib链接时,无论我使用这个.lib的 代码生成 选项,我都明白了:

1>Linking...
1>libcmtd.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)
1>libcmtd.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
1>libcmtd.lib(malloc.obj) : error LNK2005: _V6_HeapAlloc already defined in LIBCMT.lib(malloc.obj)
1>libcmtd.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: __get_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: __set_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: __set_amblksiz already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: __get_amblksiz already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_heap_init already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_find_block already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_free_block already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_block already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_region already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_group already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_resize_block already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_heapmin already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_heap_check already defined in LIBCMT.lib(sbheap.obj)
1>libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_pHeaderDefer already defined in LIBCMT.lib(sbheap.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)
1>msvcrtd.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>msvcrtd.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: __invalid_parameter already defined in LIBCMT.lib(invarg.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: __CrtDbgReportW already defined in libcmtd.lib(dbgrptw.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in LIBCMT.lib(stdexcpt.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in LIBCMT.lib(stdexcpt.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in LIBCMT.lib(stdexcpt.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in LIBCMT.lib(stdexcpt.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: ___iob_func already defined in libcmtd.lib(_file.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _wcstombs already defined in libcmtd.lib(wcstombs.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _wcslen already defined in LIBCMT.lib(wcslen.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _isdigit already defined in LIBCMT.lib(_ctype.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _strncmp already defined in LIBCMT.lib(strncmp.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _fopen already defined in libcmtd.lib(fopen.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _fclose already defined in libcmtd.lib(fclose.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _fread already defined in libcmtd.lib(fread.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _fseek already defined in libcmtd.lib(fseek.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _ftell already defined in libcmtd.lib(ftell.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: __vscprintf already defined in libcmtd.lib(vsprintf.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _fflush already defined in libcmtd.lib(fflush.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: __strnicmp already defined in LIBCMT.lib(strnicmp.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _sprintf already defined in libcmtd.lib(sprintf.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _memmove already defined in LIBCMT.lib(memmove.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _strftime already defined in LIBCMT.lib(strftime.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: ___timezone already defined in LIBCMT.lib(timeset.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: __tzset already defined in LIBCMT.lib(tzset.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _isspace already defined in LIBCMT.lib(_ctype.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _getenv already defined in LIBCMT.lib(getenv.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: __stricmp already defined in LIBCMT.lib(stricmp.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _isxdigit already defined in LIBCMT.lib(_ctype.obj)
1>msvcrtd.lib(MSVCR90D.dll) : error LNK2005: _strstr already defined in libcmtd.lib(strstr.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::allocator<char>::allocator<char>(void)" (??0?$allocator@D@std@@QAE@XZ) already defined in TestPoDoFo.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::allocator<char>::allocator<char>(class std::allocator<char> const &)" (??0?$allocator@D@std@@QAE@ABV01@@Z) already defined in TestPoDoFo.obj

如果它有用,我也发布了这个:

/Od /I "..\Podofo.Include\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MTd /Yu"stdafx.h" /Fp"Debug\TestPoDoFo.pch" /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

与.lib链接的测试项目(.exe)也不应该是 多线程调试DLL(/ MDd) ??

1 个答案:

答案 0 :(得分:1)

通常,您的所有项目都应使用多线程调试DLL(/ MDd)