• 21936阅读
  • 4回复

无法解析的外部符号 __thiscall QString::toStdWString [复制链接]

上一主题 下一主题
离线leonzhou
 
只看楼主 倒序阅读 楼主  发表于: 2010-07-26
1>------ 已启动生成: 项目: pccwclient, 配置: Debug Win32 ------
1>正在编译...
1>cmainwidget.cpp
1>正在链接...
1>qeaplocalserver.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall QString::toStdWString(void)const " (__imp_?toStdWString@QString@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ)
1>qsystem.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall QString::toStdWString(void)const " (__imp_?toStdWString@QString@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ)
1>cmainwidget.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall QString::toStdWString(void)const " (__imp_?toStdWString@QString@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ),该符号在函数 "private: bool __thiscall CMainWidget::InitConnectionManager(void)" (?InitConnectionManager@CMainWidget@@AAE_NXZ) 中被引用
1>qdialogavailablenetworks.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall QString::toStdWString(void)const " (__imp_?toStdWString@QString@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ)
1>qdialogchooseoperator.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall QString::toStdWString(void)const " (__imp_?toStdWString@QString@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ)
1>qdialoghotspotmanager.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall QString::toStdWString(void)const " (__imp_?toStdWString@QString@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ)
1>qdialogpagemobilenetwork.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?fromStdWString@QString@@SA?AV1@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>qdialogpersonalwificonfigtab.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?fromStdWString@QString@@SA?AV1@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>qdialogselectdevice.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?fromStdWString@QString@@SA?AV1@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>qeaplocalserver.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?fromStdWString@QString@@SA?AV1@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>cmainwidget.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?fromStdWString@QString@@SA?AV1@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z),该符号在函数 "private: void __thiscall CMainWidget::UpdateCMSettings(void)" (?UpdateCMSettings@CMainWidget@@AAEXXZ) 中被引用
1>qdialogavailablenetworks.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?fromStdWString@QString@@SA?AV1@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>qdialogchooseoperator.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?fromStdWString@QString@@SA?AV1@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>qdialoghotspotmanager.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?fromStdWString@QString@@SA?AV1@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>cmainwidget.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromWCharArray(wchar_t const *,int)" (__imp_?fromWCharArray@QString@@SA?AV1@PB_WH@Z),该符号在函数 "private: void __thiscall CMainWidget::SlotDataCardRegistedNetworkChanged(enum eDataCardRegStatusCode,wchar_t const *)" (?SlotDataCardRegistedNetworkChanged@CMainWidget@@AAEXW4eDataCardRegStatusCode@@PB_W@Z) 中被引用
1>qdialogdeviceinfotab.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromWCharArray(wchar_t const *,int)" (__imp_?fromWCharArray@QString@@SA?AV1@PB_WH@Z)
1>qlog.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class QString __cdecl QString::fromWCharArray(wchar_t const *,int)" (__imp_?fromWCharArray@QString@@SA?AV1@PB_WH@Z)
1>ndisinterfaceimpl.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: int __thiscall QString::toWCharArray(wchar_t *)const " (__imp_?toWCharArray@QString@@QBEHPA_W@Z),该符号在函数 "bool __cdecl GP_ICM_CONNMGR::NdisSDK::NdisInit(class GP_ICM_CONNMGR::CDialupProfile *)" (?NdisInit@NdisSDK@GP_ICM_CONNMGR@@YA_NPAVCDialupProfile@2@@Z) 中被引用
1>..\bin\debug\NECM.exe : fatal error LNK1120: 4 个无法解析的外部命令
1>生成日志保存在“file://d:\Workspace(Leon)\pccw_mac\pccw\client\Debug\BuildLog.htm”
1>pccwclient - 19 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========
离线dbzhang800

只看该作者 1楼 发表于: 2010-07-26
建议:编写一个最简单调用到 toStdWString 的程序来测试一下会不会有同样的情况。
           这样的程序大概10行左右

如果重现,贴出你的编译和链接的参数,比如 /Zc:wchar_t  还是 /Zc:wchar_t-等
离线leonzhou
只看该作者 2楼 发表于: 2010-07-27
简单程序同样问题:


/Od /I ".\GeneratedFiles" /I "D:\QT\qt-win-opensource-src-4.5.0\include" /I ".\GeneratedFiles\Debug" /I "D:\QT\qt-win-opensource-src-4.5.0\include\QtCore" /I "D:\QT\qt-win-opensource-src-4.5.0\include\QtGui" /D "UNICODE" /D "WIN32" /D "QT_THREAD_SUPPORT" /D "QT_CORE_LIB" /D "QT_GUI_LIB" /FD /EHsc /MDd /Fo"Debug\\" /Fd"Debug\vc80.pdb" /nologo /c /Zi /TP /errorReport:prompt


/OUT:"D:\QT\project\String\Debug\String.exe" /NOLOGO /LIBPATH:"D:\QT\qt-win-opensource-src-4.5.0\lib" /MANIFEST /MANIFESTFILE:"Debug\String.exe.intermediate.manifest" /DEBUG /PDB:"d:\QT\project\String\debug\String.pdb" /SUBSYSTEM:WINDOWS /ERRORREPORT:PROMPT qtmaind.lib QtCored4.lib QtGuid4.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
离线leonzhou
只看该作者 3楼 发表于: 2010-07-27
把whar_t 设置成了内置类型就会出现这种错误。
离线dbzhang800

只看该作者 4楼 发表于: 2010-07-27
引用第3楼leonzhou于2010-07-27 09:59发表的  :
把whar_t 设置成了内置类型就会出现这种错误。


恩,注意一下就好了,因为你的Qt库本身编译时用的 /Zc:wchar_t- ,如果你的程序编译时采用 /Zc:wchar_t  会导致编译器对函数名进行改编时的规则不同

不管哪一个,一致就好。前几天有人遇到过这个问题。
快速回复
限100 字节
 
上一个 下一个