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
18 Posts 7 Posters 1.7k 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.
  • V Vitalii777

    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 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
    0
    • jsulmJ jsulm

      @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 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
      • hskoglundH Offline
        hskoglundH Offline
        hskoglund
        wrote 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

          @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 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
          0
          • V Vitalii777

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

            JonBJ 1 Reply Last reply
            0
            • X Xhuong

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

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote 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
              0
              • JonBJ JonB

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

                JonBJ jsulmJ 2 Replies Last reply
                0
                • X Xhuong

                  @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

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote 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

                    @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

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote 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 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
                      • X Xhuong

                        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

                        S Offline
                        S Offline
                        Sequader
                        Banned
                        wrote last edited by
                        #18
                        This post is deleted!
                        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