[Qt-interest] QString::toStdWString() link error
Tim Dewhirst
tim at bugless.co.uk
Wed Feb 11 08:39:56 CET 2009
Hello,
John Michael Zorko wrote:
> I'm trying to use the Windows version of Qt, and when I try to use
> QString::toStdWString(), I get an unresolved external:
>
> error LNK2019: unresolved external symbol "public: int __thiscall
> QString::toWCharArray(wchar_t *)const "
> (?toWCharArray at QString@@QBEHPA_W at Z) referenced in function "public:
> class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class
> std::allocator<wchar_t> > __thiscall QString::toStdWString(void)const "
> (?toStdWString at QString@@QBE?AV?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@XZ)
> C:\Users\Administrator\work\fw40\jmz_acl\build\bin\Debug\QtAdmin.exe :
> fatal error LNK1120: 1 unresolved externals
>
> ... do I need to build Qt with a special flag or some other way to
> enable QString::toStdWString()?
Check the default flags in mkspec/win32-msvc*/qmake.conf; you're looking
to see if wchar_t is enabled as a built in type or not. In my qmake.conf
I currently have:
QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t-
i.e. wchar_t is not a built in type and is probably defined as a ushort
or similar.
I suspect the setting differs between the Qt DLL and your application.
Tim
More information about the Qt-interest-old
mailing list