qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "%QTLIB%\plugins\platforms"
-
Hi, also note that the QT_QPA_PLATFORM_PLUGIN_PATH is only used in a QGuiApplication, not in a QCoreApplication or a QApplication Qt program
Edit: Sorry QT_QPA_PLATFORM_PLUGIN_PATH env. variable is valid for Widgets apps also (my mistake).
The error must be somewhere else, perhaps there's a missing dll, try setting the env. var QT_DEBUG_PLUGINS=1 and then run DbgView to trace -
@hskoglund Note that the program runs without any problem in Qt Creator, but I get the same errors when running from Clion or manually executing the .exe file from the explorer.
Tracing the problem gave me the following output :In C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll: Plugin uses incompatible Qt library (5.14.0) [release] "The plugin 'C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll' uses incompatible Qt library. (5.14.0) [release]" not a plugin QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-debug" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/platforms" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-debug/platforms" ... qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "C:\Qt\Qt5.14.0\5.14.0\mingw73_64\plugins\platforms" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
-
As you can see you're mixing debug and release plugins. Make sure there is qwindowsd.dll in C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/
-
@Christian-Ehrlicher Qt 5.14.0 has abolished the "d"-suffix for MinGW (it remains for MSVC) (see for example https://forum.qt.io/topic/109779/windeployqt-exe-comes-with-qt-5-14-not-copy-the-dlls-to-the-app-directory
-
@Christian-Ehrlicher I only have one qwindows.dll file in
C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/
, if I should have another version and/or multiple versions where can I find them ? -
In Qt 5.14.0 MinGW uses the same qwindows.dll both for debug and release builds, so you only having one qwindows.dll is correct.
But that error message "... incompatible Qt library (5.14.0) ..." means that Qt5Core.dll is built with another version of Qt (not 5.14.0).
Could you check where your Qt5Core.dll is loaded from?
-
Ok. In your system env path, is
C:\Qt\Qt5.14.0\5.14.0\mingw73_64\bin
the first entry?Also, you could check for the presence of Qt5Core.dll and Qt5Cored.dll in your C:, for example, try:
cd \ dir Qt5core.dll/a/s dir Qt5Cored.dll/a/s
maybe there's a Qt5Core.dll (or Qt5Cored.dll) that is for a Qt version earlier than 5.14.0 that's hiding somewhere...
-
@hskoglund Restarting my computer after moving
C:\Qt\Qt5.14.0\5.14.0\mingw73_64\bin
to be the first entry (it wasn't before) solved the problem, now I can see the application's window, yet I get the following output (which I'm not sure if it's an error):Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use: QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors. QT_SCREEN_SCALE_FACTORS to set per-screen DPI. QT_SCALE_FACTOR to set the application global scale factor. QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms" ... QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll" "Failed to extract plugin meta data from 'C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qdirect2d.dll" Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qdirect2d.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "direct2d" ] }, "archreq": 0, "className": "QWindowsDirect2DIntegrationPlugin", "debug": false, "version": 331264 } Got keys from plugin meta data ("direct2d") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qminimal.dll" Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qminimal.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimal" ] }, "archreq": 0, "className": "QMinimalIntegrationPlugin", "debug": false, "version": 331264 } Got keys from plugin meta data ("minimal") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qoffscreen.dll" Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qoffscreen.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "offscreen" ] }, "archreq": 0, "className": "QOffscreenIntegrationPlugin", "debug": false, "version": 331264 } Got keys from plugin meta data ("offscreen") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwebgl.dll" Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwebgl.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "webgl" ] }, "archreq": 0, "className": "QWebGLIntegrationPlugin", "debug": false, "version": 331264 } Got keys from plugin meta data ("webgl") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll" Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "windows" ] }, "archreq": 0, "className": "QWindowsIntegrationPlugin", "debug": false, "version": 331264 } Got keys from plugin meta data ("windows") QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb ug" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/platforms" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms" ... QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll" "Failed to extract plugin meta data from 'C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qdirect2d.dll" Got keys from plugin meta data ("direct2d") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qminimal.dll" Got keys from plugin meta data ("minimal") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qoffscreen.dll" Got keys from plugin meta data ("offscreen") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwebgl.dll" Got keys from plugin meta data ("webgl") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll" Got keys from plugin meta data ("windows") QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb ug/platforms" ... loaded library "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll" QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms" ... QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll" "Failed to extract plugin meta data from 'C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qdirect2d.dll" Got keys from plugin meta data () QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qminimal.dll" Got keys from plugin meta data () QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qoffscreen.dll" Got keys from plugin meta data () QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwebgl.dll" Got keys from plugin meta data () QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll" Got keys from plugin meta data () QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb ug" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/platformthe mes" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platformthemes" ... QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platformthemes/qxdgdesktopportal.d ll" Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platformthemes/qxdgdesktopportal.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1", "MetaData": { "Keys": [ "xdgdesktopportal", "flatpak", "snap" ] }, "archreq": 0, "className": "QXdgDesktopPortalThemePlugin", "debug": false, "version": 331264 } Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap") QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb ug/platformthemes" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/styles" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles" ... QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles/qwindowsvistastyle.dll" Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles/qwindowsvistastyle.dll, metadata= { "IID": "org.qt-project.Qt.QStyleFactoryInterface", "MetaData": { "Keys": [ "windowsvista" ] }, "archreq": 0, "className": "QWindowsVistaStylePlugin", "debug": false, "version": 331264 } Got keys from plugin meta data ("windowsvista") QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb ug/styles" ... loaded library "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles/qwindowsvistastyle.dll" QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb ug/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/accessibleb ridge" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/accessiblebridge" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb ug/accessiblebridge" ... QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles/qwindowsvistastyle.dll" QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll"