0
点赞
收藏
分享

微信扫一扫

导出的函数无法导入

惠特曼 2022-09-01 阅读 43



#ifdef GLOBE_20150806
#define GLOBE_EXPIMP __declspec(dllexport)
#else
#define GLOBE_EXPIMP __declspec(dllimport)
#endif


GLOBE_EXPIMP extern std::string WideCharToMultiChar(std::wstring str);//宽字符转多字符





banlv error LNK2019: 无法解析的外部符号 "__declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl WideCharToMultiChar(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >)" (__imp_?WideCharToMultiChar@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z) ,该符号...


查看lib导出的函数:


__imp_?WideCharToMultiChar@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z


差别在于:


导入方:basic_string@G   也就是basic_string<unsigned short>


导出房:basic_string@_W  也就是basic_string<wchar_t>  。此处的wchar_t是内置类型。


所以wchar_t统一成内置类型或统一成非内置类型。



VS2002(VC7)的配置方法:“配置属性->C++->语言” 的“将wchar_t配置成内置类型


举报

相关推荐

0 条评论