简体   繁体   English

Qt应用程序的跨平台编译

[英]Cross-platform compiling of a Qt application

I have written a C++ application that uses the Qt framework. 我编写了一个使用Qt框架的C ++应用程序。 I would like to make this application available on different platforms. 我想在不同的平台上提供此应用程序。 Since I use Linux, I have no problems compiling the code for Linux. 由于我使用Linux,因此编译Linux代码没有问题。 The questions is: 问题是:

Can I compile my code in such a way that it will run on Windows, Mac, etc.? 我可以编译我的代码,使其在Windows,Mac等上运行吗? As said above, I'm working on a Linux machine and can't possibly install all the different platforms out there. 如上所述,我正在研究Linux机器,不可能安装所有不同的平台。

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! 谢谢!

You can kind of do this for Windows, but I don't think there is anything you can do for Mac. 您可以为Windows执行此操作,但我认为您无法为Mac执行任何操作。

For Windows, see these two articles: 对于Windows,请参阅以下两篇文章:

Cross-compiling Qt4/Win on Linux 在Linux上交叉编译Qt4 / Win

Cross compiling Qt/Win Apps on Linux 在Linux上交叉编译Qt / Win应用程序

Also, see this prior stack overflow question . 另外,请参阅此先前的堆栈溢出问题

With some difficulties -- you would need to install the cross-compile to create Windows binaries on Linux. 遇到一些困难 - 您需要安装交叉编译才能在Linux上创建Windows二进制文件。 That part is easy. 那部分很容易。

You would then need to configure Qt under the cross-compiler. 然后,您需要在交叉编译器下配置Qt。 Given that Qt has a number of external dependencies, I expect this to be hairy. 鉴于Qt有许多外部依赖关系,我预计这将是毛茸茸的。

In a nutshell, I think you are better installing a virtual instance of Windows inside an emulator such as VirtualBox . 简而言之,我认为您最好在VirtualBox等仿真器中安装Windows的虚拟实例。

Edit: Ah, Kaleb even points to tutorials. 编辑:啊,Kaleb甚至指向教程。 Nice one. 好一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM