[solved] strange g++ error

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
Tanuva
Posts: 54
Joined: Tue Oct 10, 2006 6:49 pm
Location: 200 metres behind the moon
Contact:

[solved] strange g++ error

Post by Tanuva »

Hello...
Im just having another try to build something useful using Irrlicht... But I cant get a device created. The tutorials all use the short parameter list for createDevice, but I would like to use the longer one. What am I doing wrong here, I couldnt find something on the forums....

This code...

Code: Select all

IrrlichtDevice* device = createDevice(driverType, dimension2d<s32>(640, 480), 32, false, true, false, &receiver, IRRLICHT_SDK_VERSION);
gives this output. Whats wrong? :roll:
marcel@marbuntu:~/dev/CppThrust$ g++ -lIrrlicht main.cpp
/tmp/ccIllJxL.o: In function `main':
main.cpp:(.text+0x1d3): undefined reference to `irr::createDevice(irr::video::E_DRIVER_TYPE, irr::core::dimension2d<int> const&, unsigned int, bool, bool, bool, irr::IEventReceiver*, char const*)'
collect2: ld returned 1 exit status
Last edited by Tanuva on Tue May 01, 2007 7:09 pm, edited 2 times in total.
Tanuva
Perceval
Posts: 158
Joined: Tue May 30, 2006 2:42 pm

Post by Perceval »

I don't really know why it doesn't work, but in the doc, it's said "DO NOT USE OR CHANGE", so there might be a reason. Anyway, i don't understand why you want to do that, since it's the default value. I think you should just remove this parameter.
Tanuva
Posts: 54
Joined: Tue Oct 10, 2006 6:49 pm
Location: 200 metres behind the moon
Contact:

Post by Tanuva »

I cant use the extended version - if I try to, it says the same... Okay, then I gonna use the simple one. But how can I pass the event receiver to the device this way?
Tanuva
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Which one's the longer or the shorter one? Yo can use the one you referenced, or createDeviceEx which is used in example 14. Your problem is probably due to linking against the wrong library, though. You have to use the one from Win32-gcc, not Win32-visual.
Tanuva
Posts: 54
Joined: Tue Oct 10, 2006 6:49 pm
Location: 200 metres behind the moon
Contact:

Post by Tanuva »

The long one is this: IrrlichtDevice *device = createDevice(driver, dimension, bpp, bool, bool, bool, eventreceiver, [something strange]);

Where I dont get it compiled using this one like you can see above. I'm sure there's also a shorter one... Cant find it at the moment. And no, I'm not linking against the wrong lib because, since I use linux, I've only one choice. Gonna have a look at 14, thanks for the hint. :)
Tanuva
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can leave out the "something strange" because it has a default value. Did you create the library from scratch and why don't you use a Makefile? You have to link against several other libraries as well.
Tanuva
Posts: 54
Joined: Tue Oct 10, 2006 6:49 pm
Location: 200 metres behind the moon
Contact:

Post by Tanuva »

If I leave out that "strange thing" ( ;) ), it produces that undefined reference to createDevice - but which other libraries do I have to link? Isnt Irrlicht all I need? *confused*

I've written simple Irrlicht apps before, but 1.3 seems to have changed a lot...
Tanuva
Perceval
Posts: 158
Joined: Tue May 30, 2006 2:42 pm

Post by Perceval »

This is a correct initialisation, which compile without any errors :

Code: Select all

IrrlichtDevice* device=createDevice(drivertype, dimension2d<s32>(640, 480), 32, false, true, false, &receiver);
I've written simple Irrlicht apps before, but 1.3 seems to have changed a lot...
Are you sure you are using the 1.3 library, and not the one from an older version ? :wink:
This part of the engine has not change, so i think you have linked the wrong library.
Tanuva
Posts: 54
Joined: Tue Oct 10, 2006 6:49 pm
Location: 200 metres behind the moon
Contact:

Post by Tanuva »

Hey, I found what was wrong. I tried to link the static library which was generated by default but I needed the shared object - made one and now it magically compiles. ;)
Tanuva
Tanuva
Posts: 54
Joined: Tue Oct 10, 2006 6:49 pm
Location: 200 metres behind the moon
Contact:

Post by Tanuva »

ARR! Never change a running program... I wanted to put the EventReceiver in its own header and cpp files - but now g++ produces a really strange error message:

Code: Select all

/tmp/ccYFfx16.o: In function `CEventReceiver::CEventReceiver()':
main.cpp:(.text._ZN14CEventReceiverC1Ev[CEventReceiver::CEventReceiver()]+0x12): undefined reference to `vtable for CEventReceiver'
/tmp/ccYFfx16.o: In function `CEventReceiver::~CEventReceiver()':
main.cpp:(.text._ZN14CEventReceiverD1Ev[CEventReceiver::~CEventReceiver()]+0x7): undefined reference to `vtable for CEventReceiver'
Ideas? :?

My Code
Tanuva
Tanuva
Posts: 54
Joined: Tue Oct 10, 2006 6:49 pm
Location: 200 metres behind the moon
Contact:

Post by Tanuva »

HA! Solved! Thanks to quaak from [#c++.de|Quakenet]. :)
I only had to add the implementation file of the eventreceiver to the compiler call... Stupid, I am! :D
Tanuva
Post Reply