Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. How to create exe file on qt6
Forum Updated to NodeBB v4.3 + New Features

How to create exe file on qt6

Scheduled Pinned Locked Moved Unsolved Qt 6
17 Posts 6 Posters 959 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.
  • X Offline
    X Offline
    Xhuong
    wrote 18 days ago last edited by Xhuong
    #1

    i want to create exe file with qt6, i tried to create with windeployqt/windeployqt6 but after creating my exe file doesn't work and there is no error message, please help me find out the cause and how to fix it. thank you!
    I use qt6.8.3 and cmake 3.50.5

    J 1 Reply Last reply 18 days ago
    1
    • X Xhuong
      18 days ago

      i want to create exe file with qt6, i tried to create with windeployqt/windeployqt6 but after creating my exe file doesn't work and there is no error message, please help me find out the cause and how to fix it. thank you!
      I use qt6.8.3 and cmake 3.50.5

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote 18 days ago last edited by
      #2

      @Xhuong You need to deploy your app first. See https://doc.qt.io/qt-6/windows-deployment.html

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

      X 1 Reply Last reply 18 days ago
      0
      • J jsulm
        18 days ago

        @Xhuong You need to deploy your app first. See https://doc.qt.io/qt-6/windows-deployment.html

        X Offline
        X Offline
        Xhuong
        wrote 18 days ago last edited by Xhuong
        #3

        @jsulm I deployed my application, but after deploying I tried to run the exe file but it couldn't run. I don't know what the cause is because when I ran the exe file I didn't see any messages.This is the program including the .dll files after I deployed.!
        68b19b60-19be-476c-98b2-1373832a5fb8-image.png (https://ddgobkiprc33d.cloudfront.net/f5e2176b-bb82-42d7-958e-780d7144b1ea.png) fce66c05-c40d-4b63-86b7-3e63a6218c02-image.png e5f175c6-b350-4761-9e27-7f04e94fc0bf-image.png

        J 1 Reply Last reply 18 days ago
        0
        • X Xhuong
          18 days ago

          @jsulm I deployed my application, but after deploying I tried to run the exe file but it couldn't run. I don't know what the cause is because when I ran the exe file I didn't see any messages.This is the program including the .dll files after I deployed.!
          68b19b60-19be-476c-98b2-1373832a5fb8-image.png (https://ddgobkiprc33d.cloudfront.net/f5e2176b-bb82-42d7-958e-780d7144b1ea.png) fce66c05-c40d-4b63-86b7-3e63a6218c02-image.png e5f175c6-b350-4761-9e27-7f04e94fc0bf-image.png

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote 18 days ago last edited by
          #4

          @Xhuong Start your app from a terminal after setting QT_DEBUG_PLUGINS environment variable and check the output. See https://doc.qt.io/qt-6/debug.html

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

          X 1 Reply Last reply 17 days ago
          1
          • V Offline
            V Offline
            Vitalii777
            wrote 18 days ago last edited by
            #5

            The 'windeployqt' does not include all necessary files needed for properly app starting, looking on my latest experience with using qt 6.8. I received a white window on app start. I was needed to manually check and add a few missing dlls and QML files into folder with 'exe' to run executable properly.

            S X 2 Replies Last reply 18 days ago
            0
            • V Vitalii777
              18 days ago

              The 'windeployqt' does not include all necessary files needed for properly app starting, looking on my latest experience with using qt 6.8. I received a white window on app start. I was needed to manually check and add a few missing dlls and QML files into folder with 'exe' to run executable properly.

              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote 18 days ago last edited by SGaist
              #6

              @Vitalii777 if QML files are missing, it usually means that the operator did not use the --qmldir argument.

              [edit: fixed option name]

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

              V 1 Reply Last reply 17 days ago
              1
              • S SGaist
                18 days ago

                @Vitalii777 if QML files are missing, it usually means that the operator did not use the --qmldir argument.

                [edit: fixed option name]

                V Offline
                V Offline
                Vitalii777
                wrote 17 days ago last edited by
                #7

                @SGaist thank you for information.

                1 Reply Last reply
                0
                • V Vitalii777
                  18 days ago

                  The 'windeployqt' does not include all necessary files needed for properly app starting, looking on my latest experience with using qt 6.8. I received a white window on app start. I was needed to manually check and add a few missing dlls and QML files into folder with 'exe' to run executable properly.

                  X Offline
                  X Offline
                  Xhuong
                  wrote 17 days ago last edited by
                  #8

                  @Vitalii777 Thank you for the suggestion, could you please tell me which files and folders are missing so I can check and fix them?

                  V 1 Reply Last reply 17 days ago
                  0
                  • J jsulm
                    18 days ago

                    @Xhuong Start your app from a terminal after setting QT_DEBUG_PLUGINS environment variable and check the output. See https://doc.qt.io/qt-6/debug.html

                    X Offline
                    X Offline
                    Xhuong
                    wrote 17 days ago last edited by
                    #9

                    @jsulm I started my app from a terminal after setting the QT_DEBUG_PLUGINS environment variable but I can't see any messages or anything in the output.

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      hskoglund
                      wrote 17 days ago last edited by
                      #10

                      The messages are routed to the debug output, to see them you can use for example DebugView:
                      https://learn.microsoft.com/en-us/sysinternals/downloads/debugview

                      1 Reply Last reply
                      2
                      • X Xhuong
                        17 days ago

                        @Vitalii777 Thank you for the suggestion, could you please tell me which files and folders are missing so I can check and fix them?

                        V Offline
                        V Offline
                        Vitalii777
                        wrote 17 days ago last edited by Vitalii777
                        #11

                        @Xhuong said in How to create exe file on qt6:

                        @Vitalii777 Thank you for the suggestion, could you please tell me which files and folders are missing so I can check and fix them?

                        I just tested '--qml' option and it does not work, the 'qml' folder is an empty after running

                        windeployqt.exe --qml "{full_path_to_exe}"
                        

                        But I found information about using '--qmldir' in this article:

                        https://forum.qt.io/topic/73340/windeployqt-and-qml/2

                        Using '--qmldir' resolved issue without copying missing files manually so you can try to use this method.

                        Just one note that using '--qmldir' copied some files that are not used by mine test exe and it works without using these files, like a few folders in 'qml' folder - 'qml/QtMultimedia', 'qml/QtLocation', 'qml/QtPositioning', 'qml/QtQuick3D' etc. For example, before I manually copied just one 'qml/QtQuick' folder with just a few subfolders inside this folder and without '*.qml' files inside these subfolders and it works.

                        Also using '--qmldir' copied some additional dll files that are not used by app, like 'Qt6Multimedia.dll' and related 'ffmpeg' dlls, and a few other dlls. So the total package size is a bit large now (41 MB difference).

                        X 1 Reply Last reply 15 days ago
                        0
                        • V Vitalii777
                          17 days ago

                          @Xhuong said in How to create exe file on qt6:

                          @Vitalii777 Thank you for the suggestion, could you please tell me which files and folders are missing so I can check and fix them?

                          I just tested '--qml' option and it does not work, the 'qml' folder is an empty after running

                          windeployqt.exe --qml "{full_path_to_exe}"
                          

                          But I found information about using '--qmldir' in this article:

                          https://forum.qt.io/topic/73340/windeployqt-and-qml/2

                          Using '--qmldir' resolved issue without copying missing files manually so you can try to use this method.

                          Just one note that using '--qmldir' copied some files that are not used by mine test exe and it works without using these files, like a few folders in 'qml' folder - 'qml/QtMultimedia', 'qml/QtLocation', 'qml/QtPositioning', 'qml/QtQuick3D' etc. For example, before I manually copied just one 'qml/QtQuick' folder with just a few subfolders inside this folder and without '*.qml' files inside these subfolders and it works.

                          Also using '--qmldir' copied some additional dll files that are not used by app, like 'Qt6Multimedia.dll' and related 'ffmpeg' dlls, and a few other dlls. So the total package size is a bit large now (41 MB difference).

                          X Offline
                          X Offline
                          Xhuong
                          wrote 15 days ago last edited by Xhuong
                          #12

                          @Vitalii777 Thank you for this help. After following your suggestion, I was able to run the exe file when building it through the terminal (QT 6.8.3 MSVC 2022 64 bit), but I still cannot run the exe file directly. Why is that?

                          J 1 Reply Last reply 15 days ago
                          0
                          • X Xhuong
                            15 days ago

                            @Vitalii777 Thank you for this help. After following your suggestion, I was able to run the exe file when building it through the terminal (QT 6.8.3 MSVC 2022 64 bit), but I still cannot run the exe file directly. Why is that?

                            J Online
                            J Online
                            JonB
                            wrote 15 days ago last edited by
                            #13

                            @Xhuong said in How to create exe file on qt6:

                            I was able to run the exe file

                            but I still cannot run the exe file directly

                            Given the first phrase in your post what does the second phrase mean?

                            X 1 Reply Last reply 15 days ago
                            0
                            • J JonB
                              15 days ago

                              @Xhuong said in How to create exe file on qt6:

                              I was able to run the exe file

                              but I still cannot run the exe file directly

                              Given the first phrase in your post what does the second phrase mean?

                              X Offline
                              X Offline
                              Xhuong
                              wrote 15 days ago last edited by
                              #14

                              @JonB Thanks for answering my question. I can only run exe file when i use terminal QT 6.8.3 MSVC 2022 64 bit as in the picture
                              823f600b-54b1-49b6-a074-14eb00819650-image.png
                              So I want to know the reason why I can't run the exe file directly

                              J J 2 Replies Last reply 15 days ago
                              0
                              • X Xhuong
                                15 days ago

                                @JonB Thanks for answering my question. I can only run exe file when i use terminal QT 6.8.3 MSVC 2022 64 bit as in the picture
                                823f600b-54b1-49b6-a074-14eb00819650-image.png
                                So I want to know the reason why I can't run the exe file directly

                                J Online
                                J Online
                                JonB
                                wrote 15 days ago last edited by
                                #15

                                @Xhuong said in How to create exe file on qt6:

                                So I want to know the reason why I can't run the exe file directly

                                I wish you would say what you mean by this?! What does "run exe directly" mean to you other than exactly what you show? Are you talking about running it by having a shortcut on your desktop? Is that what you call "directly"?

                                Meanwhile, you are not "simply" running it from a terminal. You have opened a shell which says it is setting up its environment for Qt usage. So it's doing more than somewhere else. Does it run if you just open a terminal/Command Prompt which has nothing to do with Qt or vcvars.bat?

                                Do you want to run it somehow differently but still on your own development machine, or do you want to deploy it to an environment which does not itself already have Qt files?

                                1 Reply Last reply
                                0
                                • X Xhuong
                                  15 days ago

                                  @JonB Thanks for answering my question. I can only run exe file when i use terminal QT 6.8.3 MSVC 2022 64 bit as in the picture
                                  823f600b-54b1-49b6-a074-14eb00819650-image.png
                                  So I want to know the reason why I can't run the exe file directly

                                  J Offline
                                  J Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote 14 days ago last edited by
                                  #16

                                  @Xhuong Did you try what @hskoglund suggested?
                                  Most probably one mandatory plug-in cannot be loaded because of missing dependencies.
                                  Or a DLL is missing in your deployed application. Use https://github.com/lucasg/Dependencies to check that.

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

                                  1 Reply Last reply
                                  0
                                  • X Offline
                                    X Offline
                                    Xhuong
                                    wrote 9 days ago last edited by
                                    #17

                                    I tried, I ran in release mode and used windeployqt and had to copy additional lib files but it couldn't run and there was no notification, but if I run the program in debug mode, after the exe file is created, I can successfully run that file without having to run the windeployqt command or copy any additional lib files

                                    1 Reply Last reply
                                    0

                                    9/17

                                    20 May 2025, 02:36

                                    • Login

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