如何交叉编译 Linux 应用程序以在 Linux 中获取 Windows 可执行文件?

发布于 2024-07-25 22:56:47 字数 300 浏览 4 评论 0原文

我需要在 Linux 中交叉编译我的 QT 应用程序。 我在 Linux 中从 QT SDK 编译了我的应用程序,它运行正常。
如何在 Linux 中为同一应用程序创建 .exe。 我已经在Linux和qmake中安装了Mingw,但我不知道如何进行交叉编译。
如何将我的 QT 与 MinGW 和 Qmake 等交叉编译器链接。 我正在使用 SuSE Linux。 我也浏览过 http://Silmore/29 但我不清楚如何进一步进行。

I need to cross compile my QT application in Linux. I compiled my application from the QT SDK in Linux and it is working properly.
How do I create an .exe for the same application in Linux. I have installed Mingw in Linux and qmake, but I dont know how to proceed with cross compiling.
How do I link my QT with a cross compiler like MinGW and Qmake. I am using SuSE Linux. I have also gone through http://Silmore/29 but I am not getting a clear picture of how to proceed futher.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一片旧的回忆 2024-08-01 22:56:48

您可以通过 wine 运行 Visual C++ Express Edition 2008 cl.exe 来编译您的项目。

You could run the Visual C++ Express Edition 2008 cl.exe through wine to compile your project.

明明#如月 2024-08-01 22:56:47

我不熟悉 SuSE,但 Ubuntu 有 mingw32 软件包,它是一个针对 Windows 的交叉编译器,以及开源 win32api:

替代文本
(来源:liranuna.com

经过小规模搜索,事实证明它有 RPM 这里< /a>,虽然它可能应该在您的存储库中。

I'm not familiar with SuSE, but Ubuntu has the mingw32 packages which is a windows targetted cross compiler, along with the open source win32api:

alt text
(source: liranuna.com)

After a small search, turns out there are RPMs for it here, while it should probably be in your repositories.

无需解释 2024-08-01 22:56:47

基本上,您使用跨工具链进行 Make 过程,而不是主机工具链。 我假设没有自动工具配置脚本。 如果有,您可以运行配置并指定 --host 并为您解决所有问题。

因此,您需要做的是设置 CC、LD、CFLAGs、LDFLAGS(可能还有 CXX 和 CXXFLAGS)并修改 Makefile 以使用正确的 QT 库 - 这需要是 mingw,而不是您的 Linux 库。 因此,您可能还需要获取 MinGW/Windows QT SDK 并将其单独存储,以便正确指定您的路径。

希望这可以帮助!

Basically, you use your cross-toolchain for the Make process rather than the host toolchain. I assume there is no autotools configure script. If there is you can run configure with --host specified and have it all figured out for you.

So what you'll need to do is set CC, LD, CFLAGs, LDFLAGS (probably also CXX and CXXFLAGS) and modify the Makefile to use the right QT libraries - which will need to be mingw, not your Linux libraries. So you may also need to obtain the MinGW/Windows QT SDK and store it separately so your paths cam be specified properly.

Hope this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文