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. qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "%QTLIB%\plugins\platforms"
QtWS25 Last Chance

qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "%QTLIB%\plugins\platforms"

Scheduled Pinned Locked Moved Solved Installation and Deployment
17 Posts 3 Posters 13.6k 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.
  • hskoglundH hskoglund

    Try changing to QT_QPA_PLATFORM_PLUGIN_PATH (instead of QT_QPA_PLATEFORM_PLUGIN_PATH)

    H Offline
    H Offline
    haitam
    wrote on last edited by
    #3

    @hskoglund Thanks for the response, that was just a typo in the post.

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

      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

      H 1 Reply Last reply
      0
      • hskoglundH hskoglund

        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

        H Offline
        H Offline
        haitam
        wrote on last edited by
        #5

        @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.
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #6

          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/

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

          hskoglundH H 2 Replies Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            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/

            hskoglundH Offline
            hskoglundH Offline
            hskoglund
            wrote on last edited by
            #7

            @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

            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              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/

              H Offline
              H Offline
              haitam
              wrote on last edited by
              #8

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

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

                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?

                H 1 Reply Last reply
                1
                • hskoglundH hskoglund

                  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?

                  H Offline
                  H Offline
                  haitam
                  wrote on last edited by haitam
                  #10

                  @hskoglund I'm not sure how I can check where is it loaded from, I have the following in my system env path C:\Qt\Qt5.14.0\5.14.0\mingw73_64\bin which contains Qt5Core.dll

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

                    How did you install your Qt 5.14.0, did you use the online installer or the offline installer?

                    H 1 Reply Last reply
                    0
                    • hskoglundH hskoglund

                      How did you install your Qt 5.14.0, did you use the online installer or the offline installer?

                      H Offline
                      H Offline
                      haitam
                      wrote on last edited by
                      #12

                      @hskoglund I used the offline installer

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

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

                        H 1 Reply Last reply
                        2
                        • hskoglundH hskoglund

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

                          H Offline
                          H Offline
                          haitam
                          wrote on last edited by
                          #14

                          @hskoglund All QtCore.dll and QtCored.dll files in Qt directory are for the same version 5.14.0, every other QtCore.dll file in C: belongs to other programs I have in my computer.

                          1 Reply Last reply
                          0
                          • H Offline
                            H Offline
                            haitam
                            wrote on last edited by haitam
                            #15

                            @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"
                            
                            1 Reply Last reply
                            0
                            • hskoglundH Offline
                              hskoglundH Offline
                              hskoglund
                              wrote on last edited by
                              #16

                              Think you're fine now, all that "QFactoryLoader::QFactoryLoader()...." output is because you turned on plugin tracing, removing that env. variable QT_DEBUG_PLUGINS=1 should fix it.

                              H 1 Reply Last reply
                              0
                              • hskoglundH hskoglund

                                Think you're fine now, all that "QFactoryLoader::QFactoryLoader()...." output is because you turned on plugin tracing, removing that env. variable QT_DEBUG_PLUGINS=1 should fix it.

                                H Offline
                                H Offline
                                haitam
                                wrote on last edited by
                                #17

                                @hskoglund Okay. Thank you that was really helpful!

                                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