大家好,欢迎来到IT知识分享网。
vc6.0 链接错误’ libcp.lib error LNK2001 unresolved external symbol ‘的处理
在编译链接(release)时产生如下错误:
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _sprintf
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _sprintf
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _sprintf
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
libcp.lib(locale0.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandle
libcp.lib(iostream.obj) : error LNK2001: unresolved external symbol _fclose
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol _fclose
libcp.lib(fiopen.obj) : error LNK2001: unresolved external symbol _fclose
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _memmove
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol _memmove
libcp.lib(locale0.obj) : error LNK2001: unresolved external symbol _memmove
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _memmove
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _memmove
libcp.lib(ios.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
libcp.lib(iostream.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
libcp.lib(string.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
libcp.lib(nomemory.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(class exception const &)" (??0exception@@QAE@ABV0@@Z)
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(class exception const &)" (??0exception@@QAE@ABV0@@Z)
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(class exception const &)" (??0exception@@QAE@ABV0@@Z)
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
libcp.lib(locale0.obj) : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
libcp.lib(nomemory.obj) : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall exception::what(void)const " (?what@exception@@UBEPBDXZ)
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall exception::what(void)const " (?what@exception@@UBEPBDXZ)
libcp.lib(nomemory.obj) : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall exception::what(void)const " (?what@exception@@UBEPBDXZ)
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall exception::what(void)const " (?what@exception@@UBEPBDXZ)
libcp.lib(nomemory.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(char const * const &)" (??0exception@@QAE@ABQBD@Z)
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(char const * const &)" (??0exception@@QAE@ABQBD@Z)
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(char const * const &)" (??0exception@@QAE@ABQBD@Z)
libcp.lib(ios.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(char const * const &)" (??0exception@@QAE@ABQBD@Z)
libcp.lib(string.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(char const * const &)" (??0exception@@QAE@ABQBD@Z)
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol "public: __thiscall exception::exception(char const * const &)" (??0exception@@QAE@ABQBD@Z)
libcp.lib(nomemory.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ)
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ)
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ)
libcp.lib(ios.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ)
libcp.lib(string.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ)
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ)
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _free
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _free
libcp.lib(delop.obj) : error LNK2001: unresolved external symbol _free
libcp.lib(locale0.obj) : error LNK2001: unresolved external symbol _free
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _free
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
libcp.lib(locale0.obj) : error LNK2001: unresolved external symbol _strlen
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _strlen
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _strlen
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _strlen
libcp.lib(ios.obj) : error LNK2001: unresolved external symbol _strlen
libcp.lib(iostream.obj) : error LNK2001: unresolved external symbol _strlen
libcp.lib(string.obj) : error LNK2001: unresolved external symbol _strlen
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol _strlen
libcp.lib(locale0.obj) : error LNK2001: unresolved external symbol __EH_prolog
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol __EH_prolog
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol __EH_prolog
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol __EH_prolog
libcp.lib(ios.obj) : error LNK2001: unresolved external symbol __EH_prolog
libcp.lib(iostream.obj) : error LNK2001: unresolved external symbol __EH_prolog
libcp.lib(string.obj) : error LNK2001: unresolved external symbol __EH_prolog
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol __EH_prolog
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(locale0.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(_tolower.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(xwctomb.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(ios.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(iostream.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(string.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol _memcpy
libcp.lib(iostream.obj) : error LNK2001: unresolved external symbol __iob
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol __iob
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _memset
libcp.lib(iostream.obj) : error LNK2001: unresolved external symbol _memset
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol _memset
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _memset
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _memset
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol _fputwc
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol _ungetwc
libcp.lib(wiostrea.obj) : error LNK2001: unresolved external symbol _fgetwc
libcp.lib(locale0.obj) : error LNK2001: unresolved external symbol _memcmp
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _memcmp
libcp.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol _memcmp
libcp.lib(fiopen.obj) : error LNK2001: unresolved external symbol _fopen
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _setlocale
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _malloc
libcp.lib(_tolower.obj) : error LNK2001: unresolved external symbol _malloc
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _realloc
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _strtoul
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _strtoul
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _errno
libcp.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol _errno
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _errno
libcp.lib(xwctomb.obj) : error LNK2001: unresolved external symbol _errno
libcp.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol _errno
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _errno
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _strtol
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _strtol
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _strtol
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _localeconv
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _localeconv
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol _localeconv
libcp.lib(locale.obj) : error LNK2001: unresolved external symbol _strcspn
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _strcspn
libcp.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___crtLCMapStringA
libcp.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___crtLCMapStringA
libcp.lib(_tolower.obj) : error LNK2001: unresolved external symbol __pctype
libcp.lib(_toupper.obj) : error LNK2001: unresolved external symbol __pctype
libcp.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __pctype
libcp.lib(_tolower.obj) : error LNK2001: unresolved external symbol __isctype
libcp.lib(_toupper.obj) : error LNK2001: unresolved external symbol __isctype
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcp.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcp.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcp.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcp.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcp.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcp.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcp.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcp.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcp.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcp.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcp.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcp.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcp.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol __Strftime
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol __Strftime
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol _wcslen
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol __Gettnames
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol __Gettnames
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol __Getdays
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol __Getdays
libcp.lib(wlocale.obj) : error LNK2001: unresolved external symbol __Getmonths
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol __Getmonths
libcp.lib(xstod.obj) : error LNK2001: unresolved external symbol _strtod
libcp.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___crtCompareStringA
libcp.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___lc_collate_cp
...
上面的错误是由于程序中引用了多线程库,而默认使用单线程链接导致libcp.lib不能正确链接。那么解决它,只要改成对应的Multithread(/MT)多线程库就可以了。
最后总结下/ML、/MT、/MD选项和库之间的对应关系,如下表:
library | version | C run-time library | standard C++ library | ||||||||||
release | debug | release | debug | ||||||||||
opt | import | dll | opt | import | dll | opt | import | dll | opt | import | dll | ||
static library | single thread | /ML | libc.lib | — | /MLd | libcd.lib | — | /ML | libcp.lib | — | /MLd | libcp.lib | — |
multithread | /MT | libcmt.lib | — | /MTd | libcmtd.lib | — | /MT | libcpmt.lib | — | /MTd | libcpmtd.lib | — | |
dynamic library | visual studio 6.0 | /MD | msvcrt.lib | msvcrt.dll | /MDd | msvcrtd.lib | msvcrtd.dll | /MD | msvcprt.lib | msvcp60.dll | /MDd | msvcprtd.lib | msvcp60d.dll |
visual studio 2005 | msvcr80.dll | msvcr80d.dll | msvcp80.dll | msvcp80d.dll | |||||||||
visual studio 2008 | msvcr90.dll | msvcr90d.dll | msvcp90.dll | msvcp90d.dll | |||||||||
visual studio 2010 | msvcr100.dll | msvcr100d.dll | msvcp100.dll | msvcp100d.dll | |||||||||
visual studio 2013 | msvcr120.dll | msvcr120d.dll | msvcp120.dll | msvcp120d.dll |
Note Starting in Visual C++ 2005, LIBCP.LIB and LIBCPD.LIB (via the old /ML and /MLd options) have been removed. Use LIBCPMT.LIB and LIBCPMTD.LIB instead via the /MT and /MTd options.
其中 /ML、/MLd选项和libcp.lib、libcpd.lib库在Visual C++ 2005版编译器及后继续的版本中将被删除。取而代之的是/MT、/MTd选项和libcpmt.lib、libcpmtd.lib引入库文件。
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/21344.html