Qt 5.4 static build produces “unresolved external symbol” link error in Visual Studio 2013

前端 未结 1 1160
有刺的猬
有刺的猬 2021-01-06 02:44

I want to use a static build of Qt 5.4. Since there is no precompiled static build available, you have to build one from the Qt source code yourself.

My environment

相关标签:
1条回答
  • 2021-01-06 03:05

    I found the solution:

    You have to add the following libraries to your additional dependencies in Visual Studio:

    Ws2_32.lib opengl32.lib qtharfbuzzng.lib

    Then, my project finally compiled.

    However, that is not the end of the story:

    Although successfully compiled, my application showed the following error message on startup:

    This application failed to start because it could not find or load the Qt platform plugin "windows".

    To solve this, you have to add even more libraries to your additional dependencies:

    imm32.lib winmm.lib Qt5PlatformSupport.lib qwindows.lib

    ...and the following to your additional library directories:

    $(QTDIR)\plugins\platforms

    ...and the following to your source code:

    #include <QtPlugin>
    Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
    

    Done! Finally, I was able to link against static Qt libraries.

    It was worth the effort:

    The cold startup time of my application improved dramatically from about 10 seconds to less than 1 second. And instead of 14 MB DLL-files I only have to deploy a single 8 MB EXE-file.

    0 讨论(0)
提交回复
热议问题