Unsolved <Static build> qt.qpa.plugin: Could not find or load the Qt platform plugin "windows" in ""
I would like to statically link a QT program in Microsoft Visual C ++ 64Bit. For this I have compiled the QT library statically. There are no issue when I compile my application but when start a program, I get the error:
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem
I searched couple of post and tried but nothing helped me out. Like below
- I have already linked almost all of the .libraries
- Link error when i add as Q_IMPORT_PLUGIN in main.cpp
- included Qt5PlatformCompositorSupport.lib (as i didnt find the Qt5PlatformSupport.lin)
*I tested the dynamic version and it works:
*Using CMAKE file to compile the application
JonB last edited by
Set environment variable
QT_DEBUG_PLUGINS=1and then run your application. Look at the end of the long output you should get for why it gives you your error message.
I did, set the variable in cmake as below but I dont see any new lines of error , it still shows the same. I also set the plugin variable
set(QT_QPA_PLATFORM_PLUGIN_PATH "C:\\QtStatic\\Qt5132\\plugins\\platforms") set(QT_PLUGIN_PATH "C:\\QtStatic\\Qt5132\\plugins") Set(QT_DEBUG_PLUGINS 1)
It's an environment variable.
You have to set it in our IDE or the terminal you are using before starting your application.
I configured that in the environmental variable and started the application. This time i face the same error but with the path
C:\test\QTStatic\attunesoftware\FwUpdater\FWUtility\FirmwareUpdaterUtility\release>FwUtility.exe qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "C:\QtStatic\Qt5132\plugins\platforms" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
PS: Also i tried the path as below but didnt work. And in this location C:\QtStatic\Qt5132\plugins\platforms - i have qwindows.lib file
I just realised: you are supposed to have a static Qt build, the plugins should be built-in. If that not the case then you likely have an issue with your build.
On maybe silly question, did you call make install after you built Qt ?
I built QT as static with the required configuration. I could see the below files in platform plugins
- qdirect. qoffscreen... qwebgl
After build I use cmake install command to install the application.
Still not resolved