在Linux上使用Qt为Windows创建可执行文件

在Linux上使用Qt为Windows创建可执行文件

问题描述:

是否可以在Eclipse上使用相同的Qt代码在Linux和Windows上为Linux创建可执行文件?还是有必要在我的Linux机器上安装Qt Creator?

Is it possible to create an executable on Linux for both Linux and Windows using the same Qt code with Eclipse? Or is it necessary to install Qt Creator on my Linux machine?

如果要在Linux上构建Windows二进制文件,则需要交叉编译.这意味着您需要安装Windows交叉编译器,以及要与使用交叉编译器构建的库链接的库.对于基本的Qt程序,这意味着您至少需要交叉编译的Qt.

If you want to build a windows binary on linux you need to cross-compile. This means you need to have a windows cross-compiler installed plus the libraries you are linking with built with the cross compiler. For a basic Qt program this means you need at least a cross-compiled Qt.

交叉编译与Eclipse或Qt Creator无关.我不认为两者都支持开箱即用的交叉编译功能,但我想您可以让他们这样做.

Cross-compiling has nothing to do with Eclipse or Qt Creator. I don't think both support cross compiling out of the box but I guess you could make them to do so.