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 can make .exe file in qt5 for windows and linux?
Forum Updated to NodeBB v4.3 + New Features

How can make .exe file in qt5 for windows and linux?

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 6 Posters 2.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.
  • M Offline
    M Offline
    Mijaz
    wrote on 5 Jul 2021, 04:38 last edited by
    #1

    Hi everyone!
    I am using an ubuntu machine for the development of the qt application but now I need to make a .exe file that can also run on the Windows operating system. Firstly how I can make a .exe file in Linux then how it can be deployed on windows.
    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 5 Jul 2021, 04:51 last edited by
      #2

      Hi,

      If you want to build an executable for Windows on Linux you will need to cross-compile using MinGW. Depending on the libraries you are using you'll need to cross-compile them as well.

      As for the deployment, you can use Qt's installer framework or another similar tool of your choice.

      Note that it will likely be easier to setup a virtual machine with Windows and compile natively there. This will also allow you to check that your application works correctly on that OS.

      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
      • M Offline
        M Offline
        Mijaz
        wrote on 5 Jul 2021, 06:51 last edited by
        #3

        @SGaist Thanks for your reply! How I can make .exe on Linux?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mijaz
          wrote on 5 Jul 2021, 09:13 last edited by
          #4

          @SGaist If I will set up a virtual machine on windows os and try the application developed on ubuntu is it your means?

          J 1 Reply Last reply 5 Jul 2021, 09:18
          0
          • M Mijaz
            5 Jul 2021, 09:13

            @SGaist If I will set up a virtual machine on windows os and try the application developed on ubuntu is it your means?

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 5 Jul 2021, 09:18 last edited by
            #5

            @Mijaz said in How can make .exe file in qt5 for windows and linux?:

            If I will set up a virtual machine on windows os and try the application developed on ubuntu is it your means?

            You set up a virtual machine with Windows, install Qt and a compiler there and build your app for Windows there.
            This is way easier than setting up a cross compile environment on Linux to build for Windows.

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

            1 Reply Last reply
            2
            • M Offline
              M Offline
              Mijaz
              wrote on 5 Jul 2021, 11:03 last edited by
              #6

              @jsulm Is generated .exe on windows using VMWARE will run always without starting VMWARE? Is it possible?

              J 1 Reply Last reply 5 Jul 2021, 11:14
              0
              • M Mijaz
                5 Jul 2021, 11:03

                @jsulm Is generated .exe on windows using VMWARE will run always without starting VMWARE? Is it possible?

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 5 Jul 2021, 11:14 last edited by
                #7

                @Mijaz said in How can make .exe file in qt5 for windows and linux?:

                Is generated .exe on windows using VMWARE will run always without starting VMWARE?

                Of course. It does not matter whether you run an OS like Windows in a virtual machine or not. That is the whole point of virtualization.

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

                1 Reply Last reply
                3
                • M Offline
                  M Offline
                  Mijaz
                  wrote on 5 Jul 2021, 11:22 last edited by
                  #8

                  @jsulm Thanks! But if I need to cross-compiled then what I should have to do for compilation? Kindly give your best remarks on the cross compilation?

                  J 1 Reply Last reply 5 Jul 2021, 11:25
                  0
                  • M Mijaz
                    5 Jul 2021, 11:22

                    @jsulm Thanks! But if I need to cross-compiled then what I should have to do for compilation? Kindly give your best remarks on the cross compilation?

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 5 Jul 2021, 11:25 last edited by
                    #9

                    @Mijaz I never cross compiled from Linux to Windows. You should check MinGW documentation if you really want to to go this route (I again want to point out that setting up a virtual machine with Windows is WAY easier than setting up a cross compile environment).

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

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      Padawan
                      wrote on 5 Jul 2021, 15:21 last edited by
                      #10

                      You can set up a VM and compile and build it on windows then just take out that .exe file in your build directory and put it in an empty folder then open those compiler-command prompt stuff(i'm new so i dont know what they're called)d117e3d0-91fa-480f-8353-4a4f0d15bfd6-image.png
                      and type in windeployqt your_exe_filename.exe, it will build it, that's how i do mine, if your app uses QML then u write windeployqt --qmldir your_exe_name.exe
                      136007ef-5e20-41fc-9edf-a83a04e836cd-image.png

                      Ningen

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        JoeCFD
                        wrote on 5 Jul 2021, 15:27 last edited by JoeCFD 7 May 2021, 15:28
                        #11

                        Qt is not Java. Java is built once and can be run everywhere. For Qt, you use the same code, but have to build your apps on different platforms(Windows, Linux, MacOS) separately to make the executables.

                        1 Reply Last reply
                        0
                        • VRoninV Offline
                          VRoninV Offline
                          VRonin
                          wrote on 5 Jul 2021, 15:38 last edited by VRonin 7 May 2021, 16:32
                          #12

                          I'll deviate a bit from consensus above: use a hosted CI environment.
                          Even for closed sources, GitHub now offers Actions for free that is able to build, test and create release packages for every platform.
                          It's soooooooooo much easier than setting up and maintaining your VMs.

                          Alternatives:

                          • AppVeyor
                          • Travis
                          • Gitlab
                          • CircleCI

                          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                          ~Napoleon Bonaparte

                          On a crusade to banish setIndexWidget() from the holy land of Qt

                          1 Reply Last reply
                          2

                          1/12

                          5 Jul 2021, 04:38

                          • Login

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