主题:error LNK2001: 高分请教
anghost2008
[专家分:1180] 发布于 2008-03-10 09:16:00
我是在程序中引用一个lib, 这个lib在程序目录下的文件夹lib下, 我在将所引用的lib添加到link->input->object/libary modules下, 然后引用这个lib的头文件以后就出现error LNK2001: unresolved external symbol ___setlc_active信息, 请问这个是怎么回事
回复列表 (共4个回复)
沙发
lisuimeng [专家分:490] 发布于 2008-03-11 08:00:00
出现这样的问题是因为没有找到相应的库文件。
你这样配置:Tools ->Option->Directories- 在下拉列框中选择include files,然后把你要添加的文件的路径添加进去,同样,选择library files,也把路径添加进去。
里面原来就有好几项,你添加后一般是出现在末尾,你可以用箭头把它移动到第一位就可以了。
板凳
anghost2008 [专家分:1180] 发布于 2008-03-11 09:41:00
路径上我已经添加了, 不过如果我将程序中的Project->Setting下microsoft function classes选择USE MFC in a shared dll就可以正常编译但是在是用的时候出现问题, 但是这个程序是一个atl com的程序, 所以不应该是用mfc的类, 但是又必须用到一个lib, 请问这样的问题怎么解决
3 楼
anghost2008 [专家分:1180] 发布于 2008-03-11 09:58:00
具体的错误信息如下
--------------------Configuration: NewLifeScanATL - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
BillCard.cpp
LifeImage.cpp
Log.cpp
NewLifeScan.cpp
NewLifeScanATL.cpp
SettingCoverRateDlg.cpp
SettingRotateDlg.cpp
StringTokenizer.cpp
UploadInfoDlg.cpp
Util.cpp
Generating Code...
Linking...
Creating library Debug/eBaoScanCtrl.lib and object Debug/eBaoScanCtrl.exp
eBaoScanCtrl.exp : warning LNK4070: /OUT:NewLifeScanATL.DLL directive in .EXP differs from output filename "Debug/eBaoScanCtrl.dll"; ignoring directive
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol __pctype
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol __pctype
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __pctype
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___lc_collate_cp
Debug/eBaoScanCtrl.dll : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
eBaoScanCtrl.dll - 29 error(s), 2 warning(s)
4 楼
fowlerfeng [专家分:0] 发布于 2008-04-16 09:46:00
可能是lib用的是单线程,而exe用的是多线程,或者反之,引起两者不匹配
我来回复