Irrlicht 1.5, Code::Blocks, Linux - Linker issue [SOLVED]

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
Repgahroll
Posts: 88
Joined: Tue Jul 29, 2008 11:48 am

Irrlicht 1.5, Code::Blocks, Linux - Linker issue [SOLVED]

Post by Repgahroll »

Hello, im porting my small app to Linux platform, and everything went well, i compiled the examples through individual makefiles and everything was working (at extremely good performance i must add, comparing to the older 1.4.1 release) i followed a tutorial on the wiki and copied the needed files to the system paths (usr/local/include, /usr/local/lib) and i opened the example cpb files using Code::Blocks (8.2), but when i try to build the most simple example (HelloWorld) it returns a strange error:

Code: Select all

||=== Irrlicht Example 01 Hello World, default ===|
.objs/main.o||In function `main':|
/home/alan/irrlicht-1.5/examples/01.HelloWorld/main.cpp|130|undefined reference to `irr::createDevice(irr::video::E_DRIVER_TYPE, irr::core::dimension2d<int> const&, unsigned int, bool, bool, bool, irr::IEventReceiver*)'|
||=== Build finished: 1 errors, 0 warnings ===|
It doesn't make sense to me.

Thank you very much for your patience and sorry my english.
Last edited by Repgahroll on Wed Jun 24, 2009 9:02 pm, edited 2 times in total.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: 1.5, C::B, Linux - undefined reference to `irr::createDe

Post by Acki »

Repgahroll wrote:It doesn't make sense to me.
then learn a bit more about compiler/linker warnings/errors !!! :P
this error tells you that the linker can't find the lib or finds a wrong lib !!!
be sure you're using the correct lib and that it can found !!!
look into the menu "Project->Build Options..." there you should enter the correct search pathes... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Repgahroll
Posts: 88
Joined: Tue Jul 29, 2008 11:48 am

Post by Repgahroll »

It doesn't make sense because the cbp files that come with the examples already have everything linked*. :D (at least i think :) but i'll check as soon as possible)

Thank you man!
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Repgahroll wrote:It doesn't make sense because the cbp files that come with the examples already have everything linked*. :D (at least i think :) but i'll check as soon as possible)
I'm not sure about Linux, but the project files should only point to the Windows lib and I think that is wrong for Linux, isn't it ??? :lol:
or are there special projects for Linux you're using ??? ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, we have both Linux and Windows targets 8) At least for the main library, but I hope that also the examples have this set up. However, the wrong target would raise many error messages. So I guess it should work. Maybe you have an incompatible shared object somewhere in your system path?
Repgahroll
Posts: 88
Joined: Tue Jul 29, 2008 11:48 am

Post by Repgahroll »

SOLVED!! :)

It was just a linking problem :).

For some reason the libraries didn't came linked on the cbp file... (maybe different versions).

I just linked everything and now it works like a charm :) :).

The needed libraries are (on a default linux installation):

/usr/lib/libX11.a
/usr/lib/libXext.a
/usr/lib/libXxf86vm.a
/usr/lib/libGL.so

and of course the libIrrlicht.a, wherever it is. (for the examples you can use the relative path to it: ../../lib/Linux/libIrrlicht.a)

The issue was so simple i'm ashamed... next time i'll surely double check such little things :).

Thank you all! :D

PS: I posted on advanced help room 'cause i thought it was a damn hard issue to solve :)
clemens
Posts: 7
Joined: Sun May 24, 2009 7:21 am

Post by clemens »

or did you forget to add a -lIrrlicht to your LDFLAGS-Makefile entry so that the linker knows where to look for code?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Repgahroll wrote:It was just a linking problem :).

For some reason the libraries didn't came linked on the cbp file... (maybe different versions).

I just linked everything and now it works like a charm :) :).
wow, who would think about such ??? :P
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply