Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. No Qt Platform Plugin Could Be Initialized -- no qwindows.dll in Qt build directory?

No Qt Platform Plugin Could Be Initialized -- no qwindows.dll in Qt build directory?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
16 Posts 4 Posters 13.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JW16
    wrote on last edited by JW16
    #1

    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: 1254

    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.
    "

    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 suggested configure 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?

    Christian EhrlicherC 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      0
      • J JW16

        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: 1254

        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.
        "

        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 suggested configure 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?

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @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).

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        J 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @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).

          J Offline
          J Offline
          JW16
          wrote on last edited by
          #4

          @Christian-Ehrlicher

          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?

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            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.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            J 1 Reply Last reply
            0
            • SGaistS SGaist

              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 ?

              J Offline
              J Offline
              JW16
              wrote on last edited by
              #6

              @SGaist

              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

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                The Qt online installer can be found here.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by SGaist
                  #8

                  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.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    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.

                    J Offline
                    J Offline
                    JW16
                    wrote on last edited by
                    #9

                    @Christian-Ehrlicher

                    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)

                    @SGaist

                    • 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

                    1 Reply Last reply
                    0
                    • Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @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?

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      J 1 Reply Last reply
                      0
                      • hskoglundH Offline
                        hskoglundH Offline
                        hskoglund
                        wrote on last edited by
                        #11

                        Hi, also please run the qtdiag program and verify that in the Library info: part it says:
                        PluginsPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\plugins

                        J 1 Reply Last reply
                        0
                        • Christian EhrlicherC Christian Ehrlicher

                          @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?

                          J Offline
                          J Offline
                          JW16
                          wrote on last edited by
                          #12

                          @Christian-Ehrlicher

                          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?

                          1 Reply Last reply
                          0
                          • hskoglundH hskoglund

                            Hi, also please run the qtdiag program and verify that in the Library info: part it says:
                            PluginsPath: C:\Qt\5.15.5-Win64.NET2015\qtbase\plugins

                            J Offline
                            J Offline
                            JW16
                            wrote on last edited by
                            #13

                            @hskoglund

                            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

                            1 Reply Last reply
                            0
                            • hskoglundH Offline
                              hskoglundH Offline
                              hskoglund
                              wrote on last edited by
                              #14

                              Could you try qtdiag again, but this time using the qminimal dll (which is present):
                              qtdiag -platform minimal
                              and see what the Library info: part says...

                              J 1 Reply Last reply
                              0
                              • Christian EhrlicherC Offline
                                Christian EhrlicherC Offline
                                Christian Ehrlicher
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                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.

                                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                Visit the Qt Academy at https://academy.qt.io/catalog

                                1 Reply Last reply
                                0
                                • hskoglundH hskoglund

                                  Could you try qtdiag again, but this time using the qminimal dll (which is present):
                                  qtdiag -platform minimal
                                  and see what the Library info: part says...

                                  J Offline
                                  J Offline
                                  JW16
                                  wrote on last edited by
                                  #16

                                  @hskoglund

                                  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?

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved