Tag Archives: Unresolved external symbols

error LNK2019: Unresolvable external symbols “__declspec(dllimport) public: int __thiscall QString::toWCharArray(wchar_t

Problem: Compiling poppler-0.42.0\qt4 on win10 with cmake and vs2010 reports the following error.

2>poppler-document.obj : error LNK2019: Unresolvable external symbol “__declspec(dllimport) public: int __thiscall QString::toWCharArray(wchar_t *)const ” (__imp _?toWCharArray@QString@@@QBEHPA_W@Z), the symbol in the function “public: __thiscall Poppler::DocumentData::DocumentData(class QString const &,class GooString * ,class GooString *)” (? ? 0DocumentData@Poppler@@QAE@ABVQString@@@PAVGooString@@1@Z) is referenced in

Reason: The Qt library itself compiles with /Zc:wchar_t- , if your program compiles with /Zc:wchar_t it will cause the compiler to have different rules for adapting function names
Whichever one it is, consistency is good.

Solution: Project – Properties – C/C++ – Language, Set wchar_t as a built-in type and change it to match the Qt library