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 [email protected]@@@[email protected]), the symbol in the function “public: __thiscall Poppler::DocumentData::DocumentData(class QString const &,class GooString * ,class GooString *)” (? ? [email protected]@@[email protected]@@@[email protected]@[email protected]) 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

Read More: