What Environment Variables have to be set?

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
RungAaz
Posts: 11
Joined: Sat Jun 19, 2010 9:18 am

What Environment Variables have to be set?

Post by RungAaz »

Hi,

I'm new here and also new to Irrlicht.
I downloaded the Irrlicht SDK 1.7.1 but what Environment Variables do I have to set? (I'm using Windows XP)

The WIKI says: "Please note that an IDE is not required. You can just use a compiler/linker, such as GCC"

But it says nowhere how to set up Irrlich for MinGW (without any IDE).
Can you help me?

By the way: I'm German, so you can also respond in German. If you want in French, too :D

greets
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Try using "make win32" in the source-folder. I'm not on Windows right now, so I can't test, but that should usually already work.

I am not sure about the examples, it looks to me like no-one adapted those makefiles to win32 so far (sorry, most people just go with either the Code::Blocks or the VisualStudio IDE). So I suppose you would have some work ahead there.

So - no IDE is needed - but it will make your life a lot easier on Windows (on Linux it's fine).
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
RungAaz
Posts: 11
Joined: Sat Jun 19, 2010 9:18 am

Post by RungAaz »

You mean I schould write "make win32" (mingw32-make) into my command line?


In the Soucre-Folder of a example is already an existing Makefile, so I type 'mingw32-make' and I get the following error:

Code: Select all

makefile:47: Building...
g++ -I../../include -I/usr/X11R6/include  -O3 -ffast-math main.cpp -o ../../bin/
Linux/01.HelloWorld -L../../lib/Linux -lIrrlicht -L/usr/X11R6/lib -lGL -lXxf86vm
 -lXext -lX11
e:/programme/tdm-gcc/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe
: cannot find -lIrrlicht
collect2: ld returned 1 exit status
mingw32-make: *** [all_linux] Error 1
In one line it says: "cannot find -lIrrlicht"
So apparently MinGW doesn't know where the libraries are located.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

well, you have different choices... :lol:

1st - use an IDE like Code::Blocks and it's all pretty easy... ;)
2nd - copy all needed files into the same (working) directory (very bad)...
3rd - add all needed directories to the system path (but probably you'll have to do 4th too)...
4th - edit the makefile, everything was defined there !!! :)

I prefere 1st, but if I didn't want to use an IDE I would use 4th !!!
if you open the makefile you'll find all definitions there and they are well commented, so it should be no problem to enter the right pathes... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
RungAaz
Posts: 11
Joined: Sat Jun 19, 2010 9:18 am

Post by RungAaz »

OK, I'll choose 4th :D

But be sure, I'll have surely some questions.

So, IrrlichtHome := ../.. means go two directories back and you are in Irrlicht's Home directory?


In the Makefile it says:
# linker flags such as additional libraries and link paths
USERLDFLAGS =


Should I add there the library path? (IrrlichtHome/lib/$(SYSTEM))
But some lines lower it says:
all_linux all_win32 static_win32: LDFLAGS += -L$(IrrlichtHome)/lib/$(SYSTEM) -lIrrlicht

So the lib-path is already set?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

RungAaz wrote:OK, I'll choose 4th :D
it's you choice... ;)
RungAaz wrote:But be sure, I'll have surely some questions.
there are also many tutorials on the net:
http://www.opussoftware.com/tutorial/TutMakefile.htm
http://www.ijon.de/comp/tutorials/makefile.html
RungAaz wrote:So, IrrlichtHome := ../.. means go two directories back and you are in Irrlicht's Home directory?
right !!!
RungAaz wrote:In the Makefile it says:
# linker flags such as additional libraries and link paths
USERLDFLAGS =


Should I add there the library path? (IrrlichtHome/lib/$(SYSTEM))
But some lines lower it says:
all_linux all_win32 static_win32: LDFLAGS += -L$(IrrlichtHome)/lib/$(SYSTEM) -lIrrlicht

So the lib-path is already set?
yes, it's already set, but to the directory previously was defined...
in detail:
-L means "now comes a linker directory"
$(IrrlichtHome) was defined as "2 dirs up (../..)"
then comes "/lib/"
and $(SYSTEM) wasn't defined so its empty...
now you have the complete lib path: "../../lib/"
in this line you can also enter the complete lib path of your system, e.g. "-LC:/Irrlicht/lib"

the second part in this line defines the library file(s):
-l (lower case L) stands for "now comes a Lib-File"
and Irrlicht will the interpreted as "libIrrlicht.a" for MinGW...

in another line you'll also find the include path definition, it starts with -I that stands for "now comes an includes path"...
there you can also enter the complete path of your system, e.g. "-IC:/Irrlicht/include"

but remember: if you don't use the placeholders/variables, e.g. $(IrrlichtHome), you'll have to change all lines where this placeholder was used, too !!!
so it's better to use placeholders/variables... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

RungAaz wrote:You mean I schould write "make win32" (mingw32-make) into my command line?
Yes, that is what should work for compling the engine itself.
That makesfile already has a win32 build-target.

The example Makefiles are not prepared for Win32, so basically you will have to write those targets. In that case I would recommend search for some Makefile tutorial. Sooner or later every good programmer has to fight his way through Makefiles ;-)
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
RungAaz
Posts: 11
Joined: Sat Jun 19, 2010 9:18 am

Post by RungAaz »

Thank you so much for this explanation and for the two Makefale-Tutorials (especially for the German ones).

So, I could enter the full path or set $(SYSTEM) to 'Win32-gcc'.
I'll try it out, thanks!

[EDIT]
AWESOME! It works!
Thanks for your help!
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

RungAaz wrote:Thank you so much for this explanation and for the two Makefale-Tutorials (especially for the German ones).
np, yw !!! :)
btw. I'm german, too... :lol:
RungAaz wrote: AWESOME! It works!
Thanks for your help!
great, but remember this was only the very basic usage !!!
there are also options for (e.g.) compiler flags for optimising, preprocessoring and such...
for example somewhere probably is a line with -Wall...
that means show all warnings (-W = warnings, all = all)...
but to explain this all here is a bit too hard... :lol:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
RungAaz
Posts: 11
Joined: Sat Jun 19, 2010 9:18 am

Post by RungAaz »

Ah, OK Danke!

The only things I don't understand are these 'all_linux', 'all_win32', ... things.

I deleted lines like these two:

Code: Select all

all_win32 clean_win32 static_win32: SYSTEM=Win32-gcc
all_win32 clean_win32 static_win32: SUF=.exe
(mit '#' auskommentiert)

And added these lines:

Code: Select all

SYSTEM = Win32-gcc
SUF = .exe
And it works fine.
I guess 'SUF' means suffix, hence '.exe'


[EDIT]

What would be the difference between
VARIABLE := foo
and
VARIABLE = foo

If I only use a colon instead of ':=' or '=' I would say make on which files the target depends on - right?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

to set a variable write a line starting with the variable name followed by `=' or `:='.
whatever follows the `=' or `:=' on the line becomes the value.
to learn mor about the differences between them have a look here...

a simple colon ':' means a list is following (e.g. the cpp files to be compiled, seperated by a space)...

the "all_win32 clean_win32 static_win32:" lines are defining different targets, so you can make one makefile for different uses, just by defining what target should be used for compiling...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
RungAaz
Posts: 11
Joined: Sat Jun 19, 2010 9:18 am

Post by RungAaz »

Ah!
Thanks for link.

So, you are using this to make it platform independent?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

RungAaz wrote:So, you are using this to make it platform independent?
yes, for example...
or for debug and release builds, or public and private releases, or whatever releases... ;)
of course you could make a new makefile for each release, too... :lol:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

SYSTEM should be set if you call the all_win32 target. The all_X targets will simply build everything for the platform X. At least that's what it should work like. And at least at some point also did.
Post Reply