PDA

View Full Version : Link error with String::fromWCharArray (Unresolved symbol)



xtal256
25th February 2013, 10:27
I recently upgraded my project to Qt 5.0.0, and after fixing up some compile errors, i finally got it to compile successfully, only to get this link error:



unresolved external symbol “__declspec(dllimport) public: static class QString __cdecl QString::fromWCharArray(unsigned short const *,int)” (__imp_?fromWCharArray@QString@@SA?AV1@PBGH@Z)


After googling, i found some answers. But i checked and i have set “Treat wchar_t as built in type” to “no”. And i have added Qt5Core.lib/Qt5Cored.lib to the linker.
Here ('http://pastebin.com/hW4zNHdH') is the build output in diagnostic mode, if anyone is interested. I don’t see much regarding linking, and the only reference to fromWCharArray are the final errors.

Strangely, it actually built successfully when i set "wchar_t as build in type" to "yes". It crashed when i ran it, but that may have been caused by something else.

Should i try and find out why this setting is misbehaving, or should i just implement this solution ('http://qt-project.org/wiki/toStdWStringAndBuiltInWchar')?