Compiling a tutorial for Windows with gcc/MinGW

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
MickeyKnox
Posts: 58
Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe

Compiling a tutorial for Windows with gcc/MinGW

Post by MickeyKnox »

I would like to compile my game for Windows, and i would like to do that from a linux host (cross compiling). Thus, i installed MinGW. A first hello Windows test worked fine :D

Now i want to compile one of the irrlicht tutorials, before bothering to compile my game.
I stumbled over the libraries for Windows. In lib/Win32-gcc i discovered two files:
libIrrlicht.a and libIrrlicht.def. A few questions arose:
What is libIrrlicht.def for?
Why is libIrrlicht.a so small (about 10kb)?

Then i had a look in bin/Win32-gcc and discovered a file Irrlicht.dll. This file has a size of
about 5mb. Which file to use now?
Why is the linux lib so much bigger (about 37mb)?

What about all the other libs, i need to link in when compiling for linux?

These might be stupid questions, sorry, but i've never programmed nor compiled anything for Windows and i don't know, how the thing with the libraries work there.
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

You have to link with the libIrrlicht.a and put the Irrlicht.dll into the same folder as the exe of your program.

The libIrrlicht.a is so small because the code of the engine is in the DLL. The library just tells the linker that the DLL has this code.

The def file is afaik for linking the engine by hand or something. I never needed or used the def files.

Why the linux lib is so much bigger? Well I have to guess but I'd say that it includes the runtime library and other things that are already present on a windows installation and can be dynamicly loaded. But I don't know for sure.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
MickeyKnox
Posts: 58
Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe

Post by MickeyKnox »

Thanks for your explanations.

I managed to compile the TerrainRendering Tutorial for Windows. This was actually quiet
easy, i just had to specifie the compiler to use in the Makefile:

Code: Select all

all_win32: CXX = i586-mingw32msvc-g++
Then i run the resulting executible with wine and made a very interesting discovery:
While the TerrainRendering Demo compiled natively for linux runs with about 200-250 FPS,
the one for windows runs - wrapped with wine - with about 350-400 FPS. In both cases i've
chosen to render using opengl.

Any ideas, why this is so? This kind of makes irrlicht being cross-platform almost pointless,
when i get a better experience with a windows executible wrapped with wine, then with a
native executible.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

200 fp to 400 fps is not really a big difference (2-3 ms), so that could really be caused by lots of factors, so unless there's a serious difference I wouldn't care too much. My experience with wine so far was that it generally was always around the same speed than the native linux version. Which is not that suprising as pure 3D applications are mostly dependend on the graphic-card. But you might like native linux clients as soon as you do more than just pushing polygons to the graphic card.

I can't do cross-platform to compare as the corresponding i586-mingw32msvc libstdc++ which is currently in debian does define some _powf when it shouldn't :-(
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The linux library is compiled with debugging symbols by default. Just strip the library and you get a much smaller one.
For compiling with the Makefile with different compilers you shouldn't alter the file, but set the CXX and CC variables on the make call like this:
CXX=mycompiler CC=gcc-4.4 make
MickeyKnox
Posts: 58
Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe

Post by MickeyKnox »

What does 'strip the library' mean?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

strip is the name of the command line program which will strip the debug info out of the library.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply