How can make .exe file in qt5 for windows and linux?
-
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! -
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.
-
@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. -
@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.
-
@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).
-
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)
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
-
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: