vs2010报错:
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 CCollectClientInfo::GetSystemName(class QString &)" (?GetSystemName@CCollectClientInfo@@AAEXAAVQString@@@Z) 中被引用
原因:
msvc2008
之前,wchar_t 是作为 unsigned short 来处理的,从vs2008开始,默认将其作为内置类型来处理。
如果想仍将其作为 unsigned short 的别名:则需要
-
/Zc:wchar_t-
When using QString::fromWCharArray(const wchar_t* , int size = - 1);
vs2005 gives the following error:Qt Code:
-
error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QString __cdecl QString::fromWCharArray(wchar_t const *,int)" (__imp_?fromWCharArray@@@SA?AV1@PB_WH@Z) referenced in function "public: void __thiscall midiIO::queryMidiInDevices(void)" (?queryMidiInDevices@midiIO@@QAEXXZ)
C/C++ --> Language, and set 'Treat wchar_t as Built-in Type' to No. -
- Hope it helps someone, it fixed my day...