简体   繁体   English

如何在 Linux 中将 .cpp 文件编译为 Windows 可执行 (.exe) 文件

[英]How to compile a .cpp file into a Windows executable (.exe) file in Linux

I make this program in C++ using Code::Blocks on Ubuntu.我在 Ubuntu 上使用 Code::Blocks 在 C++ 中制作了这个程序。 I need to turn it into a Windows executable binary (.exe file), but I don't know how to do this.我需要将其转换为 Windows 可执行二进制文件(.exe 文件),但我不知道该怎么做。 Is it possible?可能吗?

如果您的意思是在 Linux 上为 Windows 编译可执行文件,您可能会在此处找到有关如何执行此操作的一些指示。

Both the MinGW32 distribution of GCC and Wine should be available for your distribution. GCC 和 Wine 的 MinGW32 发行版都应该可用于您的发行版。

MinGW has instructions and winegcc wraps a similar compiler that comes with the Wine distribution. MinGW 有指令并且winegcc包装了一个类似的编译器,它与 Wine 发行版一起提供。

I've used both to compile both applications and libraries for Windows.我已经使用这两种方法为 Windows 编译应用程序和库。

你可以在这里阅读如何使用 Code::Blocks 在 Linux for Windows 上编译 wxWidget 应用程序。

This is a fairly unusual question.这是一个相当不寻常的问题。 What you're asking is that you want to develop on Ubuntu, but the target platform is Windows?你问的是你想在Ubuntu上开发,但目标平台是Windows?

My guess is that you have an assignment to turn in. My belief is that you should go to a lab and compile it and make sure it's working.我的猜测是你有一个任务要上交。我认为你应该去实验室编译它并确保它正常工作。

However, doing some research, you should try mingw at http://www.mingw.org/但是,做一些研究,你应该在http://www.mingw.org/尝试 mingw

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

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