Details
Description
When you select a static build of Qt in Visual Studio, your project will not compile anymore. The reason is that you need those additional dependencies:
Ws2_32.lib opengl32.lib qtharfbuzzng.lib
If you do not add those libraries, you will receive linker error messages like "unresolved external symbol in Qt5Gui.lib(qharfbuzzng.obj)" and so on. This is surprising, because a shared library build of Qt works just fine without those dependencies.
If you then finally found all the additional dependencies and compiled your project successfully, the executable will show the following error message on startup:
This application failed to start because it could not find or load the Qt platform plugin "windows".
To fix this, you have to add the following 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)
However, these steps are documented nowhere and not always obvious.
It would be great if the Qt Visual Studio Add-in was able to deal with static builds of Qt properly. E.g. add the missing dependencies automatically if a static build is detected or provide some usage information on how to get a static build working.
There is a similar bug report (https://bugreports.qt-project.org/browse/QTBUG-43636) where someone asked me to create a bug report for the Visual Studio Add-in.
Attachments
Issue Links
- relates to
-
QTVSADDINBUG-652 When using static build of Qt, add plugin_import.cpp to project
- Closed