是否可以在 Linux 机器上编译 Windows 二进制文件? [英] Is it possible to compile Windows binaries on a Linux machine?

查看:22
本文介绍了是否可以在 Linux 机器上编译 Windows 二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的工作中,所有项目数据都驻留在 NFS 上,该 NFS 可从 Linux 和 Windows 机器(使用 Samba)访问.所有的工作都是在 Linux 上完成的,但我正在考虑为 Windows 编译一些工具,以便我可以使用 Visual Studio 进行调试.

At my work, all of the project data resides on an NFS that is accessible from both Linux and Windows machines (using Samba). All of the work is done on Linux, but I'm toying with the idea of compiling some of tools for Windows so that I can debug with Visual Studio.

我已经有一个不错的 makefile,可以使用不同的目标为 32 位或 64 位 Linux 构建代码.假设我在 NFS 的某个地方拥有所有外部库的 Windows 版本,并且假设代码足够干净可以在 Windows 下编译,是否可以在 Linux 上使用现有的 makefile 为 Windows 编译和链接我的程序?理想情况下,我想调用 makefile 一次,让它构建 32 位 Linux、64 位 Linux 和 Windows 的所有三个.

I already have a nice makefile that can build the code for both 32-bit or 64-bit Linux using different targets. Assuming I have Windows versions of all the external libraries somewhere on the NFS, and assuming the code is clean enough to compile under Windows, is it possible to compile and link my program for Windows using the existing makefile, on Linux? Ideally I'd like to call the makefile once and have it build all three of 32-bit Linux, 64-bit Linux and Windows.

一个额外的好处是可以选择使用任何 Visual Studio 元数据编译它,以便于调试.

An added plus would be the option to compile it with any Visual Studio metadata to make it easy to debug.

推荐答案

是的,您可以使用 以 MinGW 为例.

Yes, you can achieve that with MinGW for example.

但是,您可能需要在 makefile 中修改一两个选项.

However, you will probably have to adapt one or two options in your makefile.

这篇关于是否可以在 Linux 机器上编译 Windows 二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆