smallest possible code example for Irrlicht and codeblocks

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
budword
Posts: 14
Joined: Wed Aug 08, 2007 4:32 pm

smallest possible code example for Irrlicht and codeblocks

Post by budword »

Hi, I'm trying to learn to use Irrlicht and codeblocks. It hasn't been going well. I finally got codeblocks to compile some simple c++, so that at least is set up right. I have run irrlicht from the command line, so I'm pretty sure that is setup. Now my problem is getting them to work together.

I've tried the Hello World tutorial, and I get a million errors. I don't want to ask people here to debug my code for me, well, it's the hello world code, but I was hoping someone could provide a very small sample of code that uses irrlicht, just so I can figure out when I have codeblocks set up correctly.

Just to be complete, I followed the instructions here, as far as setting up codeblocks for irrlicht goes.

http://www.irrlicht3d.org/wiki/index.ph ... cksOnLinux

I followed the directions under "If you compiled it normally (with XF86):", as I'm pretty sure I haven't compiled anything in any other way. :)

Just to be complete I'll post some of my build errors here, just in case there is a linux guru who can point me in the right direction.

/home/here/irrlicht-1.3.1/examples/01.HelloWorld/main.cpp:42: error: irrlicht.h: No such file or directory
/home/here/irrlicht-1.3.1/examples/01.HelloWorld/main.cpp:53: error: ‘irr’ is not a namespace-name
/home/here/irrlicht-1.3.1/examples/01.HelloWorld/main.cpp:53: error: expected namespace-name before ‘;’ token
/home/here/irrlicht-1.3.1/examples/01.HelloWorld/main.cpp:187: error: ‘SColor’ was not declared in this scope

I used the exact example main.cpp from the helloworld example, so I couldn't even have made any copy and paste errors.

Thanks much to anyone who can point me in the right direction.

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

Post by CuteAlien »

It does not find the Irrlicht.h
Usually that's because the include path is not know to the compiler.
In Code::Blocks you should add the irrlicht include path in "Project build options" - "Directories" - "Compiler".
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
budword
Posts: 14
Joined: Wed Aug 08, 2007 4:32 pm

That was it... thank you very much.....

Post by budword »

That did the trick, thanks much.... :)

Do you know off hand what I would have to change to compile a example.exe, for windows, using directX, or openGL ?

I prefer to use Linux tools, but I want my project to be playable on windows and linux.

Thank you for your help...

David

P.S. Oh, and one other thing, I can't seem to save the build settings between projects, or even for the same project, in codeblocks, I have to reenter them each time I fire up codeblocks. Anyone have any idea what I'm doing wrong ?

Thank you.
CuteAlien
Admin
Posts: 9933
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

No guarantee for windows... I have no minimal project for C::B right now, but in a larger project I link to those (maybe not all of those are needed):

mingw32
winmm
gdi32
libIrrlicht.a (from Win32-gcc folder)

And in compiler defines I set:
__GNUWIN32__

That should work for OpenGL. For DirectX you will additionally need to recompile Irrlicht with DirectX enabled in IrrCompileConfig.h

I don't know about the problem with project settings, that works here. Doesn't it help to save the project? Or maybe save all projects? Maybe better ask about that in the c::b forum.
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
Post Reply