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.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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on 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
    • MijazM Offline
      MijazM Offline
      Mijaz
      wrote on last edited by
      #3

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

      1 Reply Last reply
      0
      • MijazM Offline
        MijazM Offline
        Mijaz
        wrote on 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?

        jsulmJ 1 Reply Last reply
        0
        • MijazM Mijaz

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

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on 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
          • MijazM Offline
            MijazM Offline
            Mijaz
            wrote on last edited by
            #6

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

            jsulmJ 1 Reply Last reply
            0
            • MijazM Mijaz

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

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on 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
              • MijazM Offline
                MijazM Offline
                Mijaz
                wrote on 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?

                jsulmJ 1 Reply Last reply
                0
                • MijazM Mijaz

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

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 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
                  • PadawanP Offline
                    PadawanP Offline
                    Padawan
                    wrote on 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
                    • JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on last edited by JoeCFD
                      #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 last edited by VRonin
                        #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

                        • Login

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