Why can't devices be global?

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
Nosvera2
Posts: 16
Joined: Wed May 28, 2008 3:11 am
Location: Van Buren, Arkansas

Why can't devices be global?

Post by Nosvera2 »

This has been frustrating me for the longest time and no one seems able to answer my question. Why can't I declare Irrlicht devices to be global?
The code: IrrlichtDevice* device;
returns the error: [Linker Error] undefined reference to '_imp_createDevice' [Build Error]
but no one can explain why or how to fix it. I just want to be able to access the device, driver, and environment in my outlying functions through main(). Can anyone help cuz this defies the syntax of C++?
freetimecoder
Posts: 226
Joined: Fri Aug 22, 2008 8:50 pm
Contact:

Post by freetimecoder »

This seems to be a linking error. What ide/compiler do you use?
You have to link the irrlicht.lib or irrlicht.a into your project.

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

Post by Acki »

freetimecoder wrote:This seems to be a linking error.
right, but to be more precise: it doesn't seem to be a linker error, it is a linker error:
[Linker Error] undefined reference to '_imp_createDevice'
also it's not related to the global IrrlichtDevice, it tells you that it's related to createDevice !!! :lol:

like freetimecoder said, check if you linked against the right lib (or against the lib at all) !!! ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Nosvera2
Posts: 16
Joined: Wed May 28, 2008 3:11 am
Location: Van Buren, Arkansas

Thank you all for the help!

Post by Nosvera2 »

Thank you all for the help...I am using Dev-C++ and I was including the "lib" folder in the directory but not including the linker to libirrlicht.a. I have corrected it and everything seems to be working now.
Post Reply