Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to make an standalone .exe of simple Qt console application
QtWS25 Last Chance

How to make an standalone .exe of simple Qt console application

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 6.0k 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.
  • DannyL408D Offline
    DannyL408D Offline
    DannyL408
    wrote on last edited by DannyL408
    #1

    Hello I am using QtMinGW 5.6 Creator (Community) open source edition on windows 7

    I would like to know how to build my application so it can run standalone in an exe.
    The guides ive looked up did not work

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kenchan
      wrote on last edited by kenchan
      #2

      Your post is not very clear about how you deployed your .exe. Usually when deploying a Qt app you must also deploy all related dlls used by the .exe. This is normal for Windows with any kind of application and particularly Qt.

      Try running the windeployqt.exe file which you will probably find in the Qt bin folder where you installed Qt.
      See this doc for more details... Qt for Windows - Deployment
      I don't develop on Windows using QtMinGW I use MSVC so I am not sure about QtMinW specifics but I hope this information will give you a hint.

      1 Reply Last reply
      2
      • DannyL408D Offline
        DannyL408D Offline
        DannyL408
        wrote on last edited by DannyL408
        #3

        I have looked at that documentation. I am not too familair with turning my program into .exe's at all so i dont know how i "deployed it".

        running windployqt.exe just automatically opens and closes quickly

        in that windows deployment tutorial i have tried t o type the commands in windows cmd prompt but none of them work as it says "not recognized as an internal or external command..."

        K 1 Reply Last reply
        0
        • DannyL408D DannyL408

          I have looked at that documentation. I am not too familair with turning my program into .exe's at all so i dont know how i "deployed it".

          running windployqt.exe just automatically opens and closes quickly

          in that windows deployment tutorial i have tried t o type the commands in windows cmd prompt but none of them work as it says "not recognized as an internal or external command..."

          K Offline
          K Offline
          kenchan
          wrote on last edited by
          #4

          @DannyL408

          OK well, I usually do it using a batch file run from QtCreator. If you do it by hand it should be done like this.

          in a command window enter the following
          <path to windeployqt>windeployqt.exe --verbose=3 --dir <path to your deployment directory> <path to your Qt app .exe >yourQtApp.exe

          I recommend you prepare a directory to put the result of the deployment in because you will get a ton of folders and files in there depending on what Qt modules you used in your app.

          The usual rules about spaces in paths apply here so use "" if you have spaces in the paths.
          The --verbose=3 will give you a ton of output so you can see what was done.

          You should be good to go after that.

          1 Reply Last reply
          1
          • DannyL408D Offline
            DannyL408D Offline
            DannyL408
            wrote on last edited by DannyL408
            #5

            Thank you for the quick reply, i have done that command.

            Does this directory contain all the shared dlls i need and i just add my release .exe into this folder or any other .exe i want to use?

            K 1 Reply Last reply
            0
            • DannyL408D DannyL408

              Thank you for the quick reply, i have done that command.

              Does this directory contain all the shared dlls i need and i just add my release .exe into this folder or any other .exe i want to use?

              K Offline
              K Offline
              kenchan
              wrote on last edited by
              #6

              @DannyL408
              As far as I recall your Qt app.exe should also be copied to the deployment folder you specified with the --dir option.
              If it was not copied then yes, copy it to the same folder.

              You will see all the dlls and other files and subfolders with dlls that your app needs in the deployment folder you specified.

              Your app should run from that folder and it should find the dlls it needs.

              1 Reply Last reply
              1
              • DannyL408D Offline
                DannyL408D Offline
                DannyL408
                wrote on last edited by DannyL408
                #7

                nevermind i fixed the error.

                So do i jsut need to run this everytime i want to deploy an .exe and it will grab every single library i need ? or will i sometimes need to add my own .dlls

                K 1 Reply Last reply
                0
                • DannyL408D DannyL408

                  nevermind i fixed the error.

                  So do i jsut need to run this everytime i want to deploy an .exe and it will grab every single library i need ? or will i sometimes need to add my own .dlls

                  K Offline
                  K Offline
                  kenchan
                  wrote on last edited by
                  #8

                  @DannyL408

                  You really only need to run that deployment tool at first deployment or when you change the Qt libraries or the version you use but there is no harm in running it every time you build... it takes up time to copy stuff.

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kenchan
                    wrote on last edited by
                    #9

                    And yes, I think you need to add any libraries that Qt does not know about.

                    1 Reply Last reply
                    0
                    • DannyL408D Offline
                      DannyL408D Offline
                      DannyL408
                      wrote on last edited by
                      #10

                      Thank you for your help!
                      Also do you happen to know if they have an .exe to make a static exe without the .dlls or do i have to do it some other way

                      K 1 Reply Last reply
                      0
                      • DannyL408D DannyL408

                        Thank you for your help!
                        Also do you happen to know if they have an .exe to make a static exe without the .dlls or do i have to do it some other way

                        K Offline
                        K Offline
                        kenchan
                        wrote on last edited by
                        #11

                        @DannyL408
                        You must use a static build of Qt to build a static application. That means you must build a static Qt yourself. I think you must have the commercial license to be able to do that legally but I am not an expert on that kind of thing.

                        Someone else might be able to help with that question so I would mark this post as solved and post a new question about that kind of thing

                        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