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 could be initialized
Forum Updated to NodeBB v4.3 + New Features

no qt platform could be initialized

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
15 Posts 5 Posters 22.5k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Aaron Kim
    wrote on last edited by Aaron Kim
    #1

    I'm trying to build an application statically and I compiled and set configurations for corresponding qmake.exe
    However, when I execute the file which is built by the manual static kit, the error occurs and message is like below. (Strange thing is, this error doesn't occur when I run it in the Qt creator. Only when I execute the result exe file directly)
    This application failed to start because no qt platform plugin could be initialized.
    I can not find any other post that shows same error message as mine. How can I solve this problem? I don't know if it will be helpful, I'll attach the compile output.

    23:36:46: Running steps for project untitled...
    23:36:46: Starting: "D:\qt\5.11.1\msvc2015\bin\qmake.exe" C:\Users\Coder\Desktop\qt\untitled\untitled.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
    Info: creating stash file C:\Users\Coder\Desktop\qt\build-untitled-Qt_5_11_1_mingw53_32_Static-Release.qmake.stash
    23:36:48: The process "D:\qt\5.11.1\msvc2015\bin\qmake.exe" exited normally.
    23:36:48: Starting: "D:\qt\Tools\QtCreator\bin\jom.exe" qmake_all

    jom 1.1.2 - empower your cores

    23:36:48: The process "D:\qt\Tools\QtCreator\bin\jom.exe" exited normally.
    23:36:48: Starting: "D:\qt\Tools\QtCreator\bin\jom.exe"
    D:\qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release
    D:\qt\5.11.1\msvc2015\bin\uic.exe ..\untitled\mainwindow.ui -o ui_mainwindow.h
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\main.obj.73168.15.jom
    cl -BxD:\qt\5.11.1\msvc2015\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E D:\qt\5.11.1\msvc2015\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h
    main.cpp
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\mainwindow.obj.73168.62.jom
    mainwindow.cpp
    D:\qt\5.11.1\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG --compiler-flavor=msvc --include release/moc_predefs.h -ID:/qt/5.11.1/msvc2015/mkspecs/win32-msvc -IC:/Users/Coder/Desktop/qt/untitled -ID:/qt/5.11.1/msvc2015/include -ID:/qt/5.11.1/msvc2015/include/QtWidgets -ID:/qt/5.11.1/msvc2015/include/QtGui -ID:/qt/5.11.1/msvc2015/include/QtANGLE -ID:/qt/5.11.1/msvc2015/include/QtCore -I. -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" ..\untitled\mainwindow.h -o release\moc_mainwindow.cpp
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\moc_mainwindow.obj.73168.1281.jom
    moc_mainwindow.cpp
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /OUT:release\untitled.exe @C:\Users\Coder\AppData\Local\Temp\untitled.exe.73168.2562.jom
    23:36:51: The process "D:\qt\Tools\QtCreator\bin\jom.exe" exited normally.
    23:36:51: Elapsed time: 00:05.

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

      Hi and welcome to devnet,

      Your application might be statically built, but that's not the case for its dependencies.

      See the windeployqt tool documentation on how to release an application.

      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
      1
      • A Offline
        A Offline
        Aaron Kim
        wrote on last edited by
        #3

        @SGaist I don't know what to do. Using windeployqt make dynamically built executable work, but it does not solve the problem of statically built executable.
        Which part of the post should I follow?

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

          If you want to build a fully static executable, you have to first build all its dependencies statically too.

          Which also means that you have to properly abide to the conditions of the licenses of said dependencies.

          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
          1
          • A Offline
            A Offline
            Aaron Kim
            wrote on last edited by
            #5

            I followed instructions of one blog, but I don't know if all the dependencies are built statically too. Could you let me know whether the commands below build all the dependencies statically?

            1. add to qmake
              QMAKE_LFLAGS += -static -static-libgcc
              QMAKE_CFLAGS_RELEASE -= -O2
              QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer
              DEFINES += QT_STATIC_BUILD
            1. add an environment path
              set Path=C:\Qt\Tools\mingw530_32\bin;%PATH%

            2. Move to Src folder, and command
              configure -static -release -platform win32-g++ -prefix C:\Qt\Static\5.10.0 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests

            3. next
              mingw32-make -k -j4
              mingw32-make -k install

            4. add to qmake.conf
              CONFIG += static

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

              Did you also fully re-build your application with that new Qt build of yours ?

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

              A 1 Reply Last reply
              0
              • SGaistS SGaist

                Did you also fully re-build your application with that new Qt build of yours ?

                A Offline
                A Offline
                Aaron Kim
                wrote on last edited by
                #7

                If you mean that building my application using newly made kit, then yes.

                jsulmJ 1 Reply Last reply
                0
                • A Aaron Kim

                  If you mean that building my application using newly made kit, then yes.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Aaron-Kim Full rebuild means: delete build directory, run qmake, build

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  A 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Aaron-Kim Full rebuild means: delete build directory, run qmake, build

                    A Offline
                    A Offline
                    Aaron Kim
                    wrote on last edited by
                    #9

                    @jsulm Do you mean the build directory of my application? or Qt itself?

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

                      The build folder of your application.

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

                      A 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        The build folder of your application.

                        A Offline
                        A Offline
                        Aaron Kim
                        wrote on last edited by Aaron Kim
                        #11

                        @SGaist It seems that I did. Is there any way to show you an error log or something?

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

                          You can use something like https://pastebin.com

                          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
                          • A Offline
                            A Offline
                            Aaron Kim
                            wrote on last edited by Aaron Kim
                            #13

                            @SGaist I mean, how can I get the verbose log of the error to determine what my problem is?

                            1 Reply Last reply
                            0
                            • A Aaron Kim

                              I'm trying to build an application statically and I compiled and set configurations for corresponding qmake.exe
                              However, when I execute the file which is built by the manual static kit, the error occurs and message is like below. (Strange thing is, this error doesn't occur when I run it in the Qt creator. Only when I execute the result exe file directly)
                              This application failed to start because no qt platform plugin could be initialized.
                              I can not find any other post that shows same error message as mine. How can I solve this problem? I don't know if it will be helpful, I'll attach the compile output.

                              23:36:46: Running steps for project untitled...
                              23:36:46: Starting: "D:\qt\5.11.1\msvc2015\bin\qmake.exe" C:\Users\Coder\Desktop\qt\untitled\untitled.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
                              Info: creating stash file C:\Users\Coder\Desktop\qt\build-untitled-Qt_5_11_1_mingw53_32_Static-Release.qmake.stash
                              23:36:48: The process "D:\qt\5.11.1\msvc2015\bin\qmake.exe" exited normally.
                              23:36:48: Starting: "D:\qt\Tools\QtCreator\bin\jom.exe" qmake_all

                              jom 1.1.2 - empower your cores

                              23:36:48: The process "D:\qt\Tools\QtCreator\bin\jom.exe" exited normally.
                              23:36:48: Starting: "D:\qt\Tools\QtCreator\bin\jom.exe"
                              D:\qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release
                              D:\qt\5.11.1\msvc2015\bin\uic.exe ..\untitled\mainwindow.ui -o ui_mainwindow.h
                              cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\main.obj.73168.15.jom
                              cl -BxD:\qt\5.11.1\msvc2015\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E D:\qt\5.11.1\msvc2015\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h
                              main.cpp
                              cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\mainwindow.obj.73168.62.jom
                              mainwindow.cpp
                              D:\qt\5.11.1\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG --compiler-flavor=msvc --include release/moc_predefs.h -ID:/qt/5.11.1/msvc2015/mkspecs/win32-msvc -IC:/Users/Coder/Desktop/qt/untitled -ID:/qt/5.11.1/msvc2015/include -ID:/qt/5.11.1/msvc2015/include/QtWidgets -ID:/qt/5.11.1/msvc2015/include/QtGui -ID:/qt/5.11.1/msvc2015/include/QtANGLE -ID:/qt/5.11.1/msvc2015/include/QtCore -I. -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" ..\untitled\mainwindow.h -o release\moc_mainwindow.cpp
                              cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\moc_mainwindow.obj.73168.1281.jom
                              moc_mainwindow.cpp
                              link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /OUT:release\untitled.exe @C:\Users\Coder\AppData\Local\Temp\untitled.exe.73168.2562.jom
                              23:36:51: The process "D:\qt\Tools\QtCreator\bin\jom.exe" exited normally.
                              23:36:51: Elapsed time: 00:05.

                              M Offline
                              M Offline
                              Mugga
                              wrote on last edited by Mugga
                              #14

                              @Aaron-Kim
                              you must create a directory called "platforms". In the next step you copy the qwindows.dll in the platform directory.
                              You find the dll usually in C:\Qt\Qtx.y.z\x.y.z\mingw73_64\plugins\platforms

                              S 1 Reply Last reply
                              4
                              • M Mugga

                                @Aaron-Kim
                                you must create a directory called "platforms". In the next step you copy the qwindows.dll in the platform directory.
                                You find the dll usually in C:\Qt\Qtx.y.z\x.y.z\mingw73_64\plugins\platforms

                                S Offline
                                S Offline
                                stevasway
                                wrote on last edited by
                                #15

                                @Mugga
                                fantastic you saved me! Thanks!!!!!!

                                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