Important: Please read the Qt Code of Conduct -

[SOLVED] Can not build app with Qt5 on Windows (while everything is OK on Mac)

  • I've successfully ported an app to Qt5 on Mac. But have troubles on Windows:

    @error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QString __cdecl QString::fromStdWString(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (_imp?fromStdWString@QString@@SA?AV1@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z) referenced in function "class QString __cdecl GetApplicationDataPath(void)" (?GetApplicationDataPath@@YA?AVQString@@XZ)

    "See full output":

    I'm using CMake and VisualStudio 2010.
    ! as built in type: No)!

    Qt 5.0.1 is built from official release: @set INCLUDE=%INCLUDE%;D:\icu\include;
    set LIB=%LIB%;D:\icu\lib
    configure -developer-build -opensource -nomake examples -nomake tests -openssl -I D:/Qt/openssl-1.0.1c/include -L D:/Qt/openssl-1.0.1c/lib

    Any ideas?

  • Hi,

    dllimport errors happens when a preprocessor definition is or isn't setted.
    Check in your project what preprocessor definition are defined.


  • @tchoninho, thanks for suggestions. Qt5 was compiled with /Zc:wchar_t so I've turned this option in my project and now QString issues are gone.

  • Problem is solved: I've inserted qt5_use_modules(MyApp Widgets Network Sql WebKit WebKitWidgets) only for Mac by mistake.

Log in to reply