No Qt Platform Plugin Could Be Initialized -- no qwindows.dll in Qt build directory?
-
Hello,
I have been working on porting an application from Qt 4 to Qt 5.15.5. I got to the point where my application source code builds with qmake and compiles, however, when attempting to launch the executable, I get the following error:"
Program: C:\Code\<MyAppSourceCode>\bin\Win64.NET2015\QtCored.dll
Module: 5.15.5
File: C:\Qt\<MyQt5.15.5GitRepo>\qtbase\src\gui\kernel\qguiapplication.cpp
Line: 1254This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: minimal, offscreen, webgl.
"When building Qt5.15.5, I followed the instructions described here for obtaining the source, configuring, and building.
My build is targeted for win32-msvc and I only deviated from the suggestedconfigure
command to add the--opengl desktop
option.I have copied all of the Qt5 dll's from C:\Qt\<MyQtBuildDir>\qtbase\bin\ into C:\Code\<MyAppSourceCode>\bin\Win64.NET2015\ (just to be safe, although I should only require a subset of them), as well as copying over the ...\qtbase\plugins\platforms directory. That platforms directory contains dll/lib/etc. files for qminimal, qoffscreen, and qwebgl.
After doing some digging online, I tried running windeployqt.exe like so:
windeployqt --debug --pdb --no-quick-import --no-angle --no-webkit2
and am again met with the message "Unable to find the platform plugin." after it displays the dependencies it found to be deployed (concurrent, core, gui, network, script, svg, widgets, xml)Some more digging online seems to suggest I may need the qwindows.dll from the qtbase\plugins\platforms directory, but no such file exists in my Qt build. Is this because I configured/built Qt incorrectly in some way? Is there something else going on here?
-
Hi and welcome to devnet,
Before using a custom build I would start with the latest pre-built release so you have a known working starting point.
Next, retry with your self built Qt.
That said, can you share the configure line you used ?
-
@JW16 said in No Qt Platform Plugin Could Be Initialized -- no qwindows.dll in Qt build directory?:
I have copied all of the Qt5 dll's from C:\Qt<MyQtBuildDir>\qtbase\bin\ into C:\Code<MyAppSourceCode>\bin\Win64.NET2015\ (just to be safe, although I should only require a subset of them), as well as copying over the ...\qtbase\plugins\platforms directory. That platforms directory contains dll/lib/etc. files for qminimal, qoffscreen, and qwebgl.
This is wrong. Put your Qt dlls in your PATH or properly deploy the Qt dlls to your executable folder via windeployqt which also copies the plugins to the correct directory (to <exe-file>/<plugin-type> as described here, second paragraph).
-
Ok.
If I delete the platforms dir and all of the Qt5 dll's from my executable, then run:
windeployqt --debug --pdb --no-quick-import --no-angle --no-webkit2
from \qtbase\bin, targeted at my executable folder, I again get "Unable to find the platform plugin." message after it lists my dependencies, and nothing happens (nothing is copied).With the Qt dll's from my Qt build dir in my path, I get the exact same error message as in my original post when trying to launch my executable.
Do you have any other suggestions?
-
Did you compile Qt but did not install it afterwards? What does
qmake -query
tells you where it expects it's dlls. Then make sure there are no other Qt5 dlls in your PATH and maybe use a pre-build binary Qt distribution as @SGaist suggested. Then you can also use the latest Qt6 version - if it compiles with Qt5.15 without any deprecation warnings it will most likely also compile with the latrst Qt6 version. -
Where can I download the prebuilt release of 5.15.5? I only saw links to the git repo and a zip package of the source when I looked.
I believe my configure line was
configure -developer-build -opensource -nomake examples -nomake tests -opengl desktop -confirm-license
-
The Qt online installer can be found here.
-
For the Qt 5 series, 5.15.3 and above are source release only.
Don't use developer builds unless you plan on hacking Qt itself.
-
From the page I linked in my OP:
"The -developer-build option causes more symbols to be exported in order to allow more classes and functions to be unit tested than in a regular Qt build. It also defaults to a 'debug' build, and installs the binaries in the current directory, avoiding the need for 'make install'."So I should not have a need to install.
qmake -query
output:
QT_SYSROOT:
QT_INSTALL_PREFIX:C:/Qt/5.15.5-Win64.NET2015/qtbase
QT_INSTALL_PREFIX/src:C:/Qt/qt5/qtbase
QT_INSTALL_ARCHDATA:C:/Qt/5.15.5-Win64.NET2015/qtbase
QT_INSTALL_ARCHDATA/src:C:/Qt/qt5/qtbase
QT_INSTALL_DATA:C:/Qt/5.15.5-Win64.NET2015/qtbase
QT_INSTALL_DATA/src:C:/Qt/qt5/qtbase
QT_INSTALL_DOCS:C:/Qt/5.15.5-Win64.NET2015/qtbase/doc
QT_INSTALL_DOCS/src:C:/Qt/qt5/qtbase/doc
QT_INSTALL_HEADERS:C:/Qt/5.15.5-Win64.NET2015/qtbase/include
QT_INSTALL_HEADERS/src:C:/Qt/qt5/qtbase/include
QT_INSTALL_LIBS:C:/Qt/5.15.5-Win64.NET2015/qtbase/lib
QT_INSTALL_LIBS/src:C:/Qt/qt5/qtbase/lib
QT_INSTALL_LIBEXECS:C:/Qt/5.15.5-Win64.NET2015/qtbase/bin
QT_INSTALL_LIBEXECS/src:C:/Qt/qt5/qtbase/bin
QT_INSTALL_BINS:C:/Qt/5.15.5-Win64.NET2015/qtbase/bin
QT_INSTALL_BINS/src:C:/Qt/qt5/qtbase/bin
QT_INSTALL_TESTS:C:/Qt/5.15.5-Win64.NET2015/qtbase/tests
QT_INSTALL_TESTS/src:C:/Qt/qt5/qtbase/tests
QT_INSTALL_PLUGINS:C:/Qt/5.15.5-Win64.NET2015/qtbase/plugins
QT_INSTALL_PLUGINS/src:C:/Qt/qt5/qtbase/plugins
QT_INSTALL_IMPORTS:C:/Qt/5.15.5-Win64.NET2015/qtbase/imports
QT_INSTALL_IMPORTS/src:C:/Qt/qt5/qtbase/imports
QT_INSTALL_QML:C:/Qt/5.15.5-Win64.NET2015/qtbase/qml
QT_INSTALL_QML/src:C:/Qt/qt5/qtbase/qml
QT_INSTALL_TRANSLATIONS:C:/Qt/5.15.5-Win64.NET2015/qtbase/translations
QT_INSTALL_TRANSLATIONS/src:C:/Qt/qt5/qtbase/translations
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:C:/Qt/5.15.5-Win64.NET2015/qtbase/examples
QT_INSTALL_EXAMPLES/src:C:/Qt/qt5/qtbase/examples
QT_INSTALL_DEMOS:C:/Qt/5.15.5-Win64.NET2015/qtbase/examples
QT_INSTALL_DEMOS/src:C:/Qt/qt5/qtbase/examples
QT_HOST_PREFIX:C:/Qt/5.15.5-Win64.NET2015/qtbase
QT_HOST_PREFIX/src:C:/Qt/qt5/qtbase
QT_HOST_DATA:C:/Qt/5.15.5-Win64.NET2015/qtbase
QT_HOST_DATA/src:C:/Qt/qt5/qtbase
QT_HOST_BINS:C:/Qt/5.15.5-Win64.NET2015/qtbase/bin
QT_HOST_BINS/src:C:/Qt/qt5/qtbase/bin
QT_HOST_LIBS:C:/Qt/5.15.5-Win64.NET2015/qtbase/lib
QT_HOST_LIBS/src:C:/Qt/qt5/qtbase/lib
QMAKE_SPEC:win32-msvc
QMAKE_XSPEC:win32-msvc
QMAKE_VERSION:3.1
QT_VERSION:5.15.5(C:\Qt\qt5 is where I checked out the code, \Qt\5.15.5-Win64.NET2015 is where I built it)
- Don't use developer builds unless you plan on hacking Qt itself.
This port of the application is in the experimental stage (it is a very large application and will likely take a lot more time to get other 3rd party libraries updated and everything playing nicely), so I wanted as much debugging capability as possible for now
-
@JW16 said in No Qt Platform Plugin Could Be Initialized -- no qwindows.dll in Qt build directory?:
C:/Qt/5.15.5-Win64.NET2015/qtbase/plugins
Is this directory available and is there the 'platforms' subdir with a qwindows.dll and qwindowsd.dll?
-
Yes, the platforms subdir is available, and it contains the release and debug dll's for qminimal, qoffscreen, and qwebgl.
There is no qwindows.dll or qwindowsd.dll, which was what my original post was asking about -- is it due to me building Qt incorrectly or missing some option somehwere?
-
qtdiag
output:
"
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.Available platform plugins are: minimal, offscreen, webgl.
":(
All signs point to me needing the qwindows.dll, yet it was not created when I built Qt somehow
-
I doubt it will work when the windows plugin was not built. Use a newer compiler - maybe it's not supported with this ancient compiler.
/edit: it needs a recent DirectX SDK according the pro-file:
win32:!winrt:qtConfig(direct3d9): SUBDIRS += windows
either use a recent compiler (which ships a recent DirectX SDK) or install the DirectX SDK separately and make sure configure.bat finds it so qwindows(d).dll can be built.
-
qtdiag -platform minimal
:
This plugin does not support createPlatformOpenGLContext!
This plugin does not support createPlatformOpenGLContext!
QRhiGles2: Failed to create temporary context
This plugin does not support createPlatformOpenGLContext!
QRhiGles2: Failed to create context
Qt 5.15.5 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2015) on "minimal"
OS: Windows 10 Version 2009 [winnt version 10.0.19044]Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2 RTM HLE
Environment:
QMAKESPEC="win32-msvc"
QTDIR="C:\Qt\5.15.5-Win64.NET2015"
QTVER="5.15.5"Features: QT_NO_EXCEPTIONS QT_NO_OPENSSL
Library info:
PrefixPath: C:\Qt\5.15.5-Win64.NET2015\qtbase
DocumentationPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\doc
HeadersPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\include
LibrariesPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\lib
LibraryExecutablesPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\bin
BinariesPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\bin
PluginsPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\plugins
ImportsPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\imports
Qml2ImportsPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\qml
ArchDataPath: C:\Qt\5.15.5-Win64.NET2015\qtbase
DataPath: C:\Qt\5.15.5-Win64.NET2015\qtbase
TranslationsPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\translations
ExamplesPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\examples
TestsPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\tests
SettingsPath:@Christian-Ehrlicher Where are you seeing this? Which .pro file are you talking about?