I'm writing my app on QT and I've produced a working version on my mac. How can make QT also compile an executable for windows?
3 Answers
Qt SOURCE is compatible to Windows, Mac, Linux, ARM and other platforms.
Qt BINARIES are platform-specific. You cannot compile an .exe on the Mac, and hope to run that binary .exe on Windows or Linux.
You'll need to cross-compile, or actually install the Qt SDK and compile on each target platform, for each different kind of .exe.

- 114,292
- 17
- 138
- 190
-
4thanks but I knew that I can't run .exe on mac. I just wanted to know if there is a way to compile a Windows distribution on OSX instead of moving the source to a pc machine to compile. – Roman Dec 08 '11 at 01:23
-
1One way is to cross-compile (e.g. MinGW). Personally, I'd just install the QT development kit for Windows on something like CrossOver, install MSVS express: http://www.microsoft.com/express, and compile QT from Visual Studio: http://doc.qt.nokia.com/vs-add-in-1.1.7/index.html – paulsm4 Dec 08 '11 at 03:05
-
In my experience, cross-compilation usually isn't worth the hassle and you'll need a Windows installation anyway to test if what you built actually works, so you don't gain that much. Additionally, if you're a good citizen writing unit tests, cross-compiling won't execute them on the target platform. – Frank Osterfeld Dec 08 '11 at 07:13
Here's a tutorial on cross compiling http://web.me.com/dove_family/martin/cross_compile.html
Or you can get a windows machine or virtual machine. Build your app with a compiler on windows and link with the windows QT libraries. For compilers you can use Visual Studio, or MinGW

- 11,800
- 1
- 26
- 34
A good start would be MinGW for OSX. It should allow you to build Windows applications on OSX.
There are more detailed instructions in another question: How do I configure Qt for cross-compilation from Linux to Windows target?

- 33,220
- 7
- 94
- 114