Compiling for Windows using Linux

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Raff1
Posts: 7
Joined: Tue Nov 03, 2009 11:09 pm

Compiling for Windows using Linux

Post by Raff1 »

Hi, this is my first shot at Irrlight! I am an Ubuntu 9.10 and just managed to compile a few examples and run the executables. However, when I went into the Makefile in examples/01.HelloWorld and changed the line below "#default target is linux" from "all: all_linux" to "all: all_win32" in order to compile a windows executable into the /bin/Win32-gcc/ folder, I got the following error message:

Code: Select all

/usr/bin/ld: cannot find -lopengl32
The attempted command was

Code: Select all

Makefile:49: Building...
g++ -I../../include -I/usr/X11R6/include  -O3 -ffast-math main.cpp -o ../../bin/Win32-gcc/01.HelloWorld.exe -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
I am not sure if changing "all: all_linux2 to "all: all_win32" in the Makefile is the correct approach. I really don't know what I am missing either. If I haven't provided enough information, please tell! Any insight is appreciated.

Regards,
Raff1
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Compiling for Windows using Linux

Post by randomMesh »

Have you seen the FAQ entry about crosscompiling?

Don't know if it helps since it's about an ancient version of Irrlicht.
"Whoops..."
kvakvs
Posts: 30
Joined: Wed Oct 14, 2009 1:50 am
Location: Sweden
Contact:

Post by kvakvs »

In general its not healthy idea to grab some large project for the first time, and try to cross-compile it.

Just changing some gcc options won't get you there. You will also need Windows C Runtime Library, Windows SDK, DirectX or OpenGL include and library files, and linker capable of linking windows executables, to say least.

If you absolutely need to build windows executable files on Linux, best thing you can do is to download some virtual machine software, set up windows on it, and install some development environment there, like visual studio express, or mingw, or stuff like that.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

On Ubuntu you should get a gcc-mingw version with a simple install. Then set the compiler variables CC=mingw-gcc and CXX=mingw-g++ (or whatever names the bins have) and you should get the proper results. BTW: You don't need to alter the default target, just call 'make all-win32'
Post Reply