views:

555

answers:

3

Dear developers,

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 :)

Lots of love, Louise

+7  A: 

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)
...
AndiDog
If you use debian, mingw32 is already in the repository, together with few precompiled libraries too.
liori
Yes just added it to my post as you wrote your comment :) Thx
AndiDog
to be complete, you'd need to provide a mingw-compatible glut library too, no ?
Bahbar
Well, there's a cross-compilation environment at http://www.nongnu.org/mingw-cross-env/. It includes freeglut, for example. But I haven't used this, so don't ask me about it ;)
AndiDog
+1  A: 

I've used mingw on Linux to make Windows executables in C, I suspect C++ would work as well.

Richard Pennington
+3  A: 

This is definitively not an easy topic, but you can try to build the cross-compiling chain for linux.

Kornel Kisielewicz