(C++) How to cross-compile a Qt Creator project from Ubuntu to a windows executable?
January 10, 2018 · View on GitHub
(C++) How to cross-compile a Qt Creator project from Ubuntu to a windows executable?




Qt FAQ about how to cross compile using Qt Creator under Linux to a Windows executable.
I use the approach of example 15: MXE most. See MXE for more information about MXE.
Examples
These examples can be viewed as approaches. Some approaches fail, two are successful, some are unexplored or abandoned.





Example 1: Hello World,
using i586-mingw32msvc-gcc




Example 2: Hello Qt, using
i586-mingw32msvc-gcc




Example 3: Hello Boost,
using i586-mingw32msvc-gcc




Example 4: any application, changing
makefile




Example 5: any application, using Qt Creator -spec
approach




Example 6: any application, using tweaked
Makefile




Example 7: any application, using universal
binaries




Example 8: any application, port to embedded linux
adaptation




Example 9: any application, use of the moc
variable




Example 10: any application, use of
MinGW




Example 11: any application, use of
GCC




Example 12: any application, use of
crosstool




Example 13: any application, Bezemer
way




Example 14: any application, NJH
approach




Example 15: MXE




Example 16: any application, use of
autotools




Example 17: any application, use of
dpkg-cross




Example 18: Hello World,
use of qmake argument '-spec win32-g++'




Example 19: Hello World,
use of qmake argument '-spec cygwin-g++'




Example 20: Hello World,
changing project file




Example 21: Hello Boost, changing project
file




Example 22: Hello Qt, changing project file




Example 23: Hello World,
using MinGW build script
Instead of cross compiling, code can also be ported from Linux to Windows using the tool Cygwin: Cygwin offers a UNIX-like environment, where compiling leads to Windows executables.
References