C ++ program in Qt made in linux to run in WIndows

6

asked by anonymous 26.06.2016 / 02:29

2 answers

6

There is an open source project called MXE , Minimalist / MinGW cross enviroment . It starts from the source code of several libraries and produces its own build versions for Windows under Linux. The use is very simple, do:

git clone https://github.com/mxe/mxe
cd mxe
make qt5

This will take some time, but it only needs to be done once. Then go to an empty folder where you want to produce the compiled project for Windows, run the following:

/pasta-onde-esta-o-mxe/usr/i686-w64-mingw32.static/qt5/bin/qmake pasta-do-seu-projeto-qt

This will produce a Makefile already configured for the mxe. Now extend your PATH to contain the MXE compiler path, and run make

PATH=$PATH:/pasta-onde-esta-o-mxe/usr/bin
make

The result will be a .exe file. You can even run it with wine !

    
09.07.2016 / 13:55
1

This is already done for other platforms and is called cross-compiling . It's how applications developed in Windows and Linux are compiled for Android. I've never really seen anyone doing cross-compiling Linux - > Windows, but it may be perfectly possible - only you'll have to look at how to set it up. You can start by looking for cross-compiling from Linux to Windows and see if anything helps.

(I know it's a weak answer, but I could not write it all as a comment)

    
29.06.2016 / 03:53