Cross-platform compiling of a Qt application
Asked Answered
B

3

10

I have written a C++ application that uses the Qt framework. I would like to make this application available on different platforms. Since I use Linux, I have no problems compiling the code for Linux. The questions is:

Can I compile my code in such a way that it will run on Windows, Mac, etc.? As said above, I'm working on a Linux machine and can't possibly install all the different platforms out there.

If it is possible, what steps are required (in simple terms)?

If there is any documentation on this topic, I'm happy to read anything - please just point me in the right direction.

Thanks!

Burchett answered 5/1, 2010 at 19:10 Comment(0)
K
8

You can kind of do this for Windows, but I don't think there is anything you can do for Mac.

For Windows, see these two articles:

Cross-compiling Qt4/Win on Linux

Cross compiling Qt/Win Apps on Linux

Also, see this prior stack overflow question.

Kettie answered 5/1, 2010 at 19:14 Comment(2)
It it possible to build a cross compiler for Mac OSX too - although it involves days - even weeks of work for those unexperienced in compiling GCC for foreign systems.Zettazeugma
Tutorial for cross-compiler on Linux targeting OS X: devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txtSeditious
O
4

With some difficulties -- you would need to install the cross-compile to create Windows binaries on Linux. That part is easy.

You would then need to configure Qt under the cross-compiler. Given that Qt has a number of external dependencies, I expect this to be hairy.

In a nutshell, I think you are better installing a virtual instance of Windows inside an emulator such as VirtualBox.

Edit: Ah, Kaleb even points to tutorials. Nice one.

Oba answered 5/1, 2010 at 19:15 Comment(0)
P
0

check MXE, it supports qt5 and qt6 https://mxe.cc/

Prophet answered 19/3, 2024 at 12:33 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.