首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

自己写的DLL,编译没有关问题,使用的时候报链接异常

2013-10-18 
自己写的DLL,编译没问题,使用的时候报链接错误error LNK2019: 无法解析的外部符号 __declspec(dllimport)

自己写的DLL,编译没问题,使用的时候报链接错误
error LNK2019: 无法解析的外部符号 "__declspec(dllimport) void __cdecl Select(int,unsigned short *,int,bool)" (__imp_?Select@@YAXHPAGH_N@Z),该符号在函数 "public: void __thiscall CMyWnd::Start(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >)" (?Start@CMyWnd@@QAEXV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@0@Z) 中被引用

头文件和lib已经添加,并且复制到工程目录下面。
[解决办法]
头文件 保证编译成功;
lib 保证链接成功。链接失败,说明lib添加有问题。
[解决办法]
检查下 包含Select库连接的路径是否正确!
[解决办法]
如果安装了msdn的话,直接查LNK2019,应该有很多说明。

其中比较常见的

1.Select有没有实现。即使编码中有了实现,也有可能在dll编译连接过程中,被优化掉,估计这个时候可以通过map文件等可以查看或其它工具(DUMPBIN)。

2.lib是否能正常查找到

热点排行