How to make .exe file on Ubuntu
Hello every one.
I wrote a code using Qt Creator 2.5.2 ( Based on Qt 4.8.1 64 bit) , which installed on Ubuntu 12.04 (precise) 64-bit. I genenrated a excutable file, which work only on Ubuntu. and when I tried to generate .exe file using the following command:
$i586-mingw32msvc-g++ -o calculator.exe main.cpp mainwindow.cpp
I got this error:
main.cpp:1:30: error: QtGui/QApplication: No such file or directory
So, how can I generate .exe file to to work on windows OS.
My best regards
To cross-compile Qt application, it's not as easy as using just g++ (you can though). But normally you use qmake to compile your Qt app.
The easiest approach would be just to compile your Qt app on windows. But it's not bad to know and learn how to do cross-compilation either. Check "this blog":http://divided-mind.blogspot.co.uk/2007/09/cross-compiling-qt4win-on-linux.html, for instructions how to do it. I found that link "here, in Qt documentation":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html.
I will check this.
Finaly, I found the solution in the following link
Here is the steps
#1 Get it:
$ git clone https://github.com/mxe/mxe.git
#2 Build Qt for Windows, its dependencies, and the cross-build tools; this will take about an hour on a fast machine with decent internet access; the download is about 500MB:
$ cd mxe && make qt
#3 Get to the directory of your app and add the cross-build tools to the PATH:
$ export PATH=<mxe root>/usr/bin:$PATH
#4 Run the Qt Makefile generator tool then build:
$ <mxe root>/usr/i686-pc-mingw32/qt/bin/qmake && make
#5 You should find the binary in the ./release directory:
$ wine release/foo.exe