如何在Linux上使用gcc / g ++编译Windows? [英] How to compile for Windows on Linux with gcc/g++?

查看:340
本文介绍了如何在Linux上使用gcc / g ++编译Windows?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上使用freeglut在C ++(g ++)中编写了一些效果,然后使用



g ++ -Wall -lglut part8.cpp -o part8

所以我想知道是否可能有g ++ make static



我没有Windows,所以如果我可以在Linux上这样做,那将会非常酷!)

解决方案

mingw32作为Linux包存在。您可以交叉编译和链接Windows应用程序。有一个教程在Code :: Blocks论坛。注意命令更改为 mingw32-gcc



EDIT:例如,Debian Linux在其存储库中有MinGW:

  $ apt-cache search mingw 
mingw32 - Minimalist GNU win32(交叉)编译器
mingw32-binutils - Minimalist GNU win32(交叉)binutils
mingw32运行时 - 最小的GNU win32(交叉)运行时
gcc-mingw32 - GNU编译器集for MingW32)
...


I have written some effects in C++ (g++) using freeglut on Linux, and I compile them with

g++ -Wall -lglut part8.cpp -o part8

So I was wondering if it is possible to have g++ make static compiled Windows executables that contains everything needed?

I don't have Windows, so it would be really cool, if I could do that on Linux :)

解决方案

mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to mingw32-gcc, for example.

EDIT: Debian Linux, for example, has MinGW in its repositories:

$ apt-cache search mingw
mingw32 - Minimalist GNU win32 (cross) compiler
mingw32-binutils - Minimalist GNU win32 (cross) binutils
mingw32-runtime - Minimalist GNU win32 (cross) runtime
gcc-mingw32 - The GNU Compiler Collection (cross compiler for MingW32)
...

这篇关于如何在Linux上使用gcc / g ++编译Windows?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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