hi, i'm new to irrlicht. and i'd like to ask something about the 04 movement tutorial.
i saw that in the main.cpp theres a class MyEventReceiver and tried to put it in another file and include it to the main so i can free space in the main.cpp file. but when i try to bult it the compiler gives me error about node:
( 'node' : undeclared identifier). it may be that IsceneNode and IrrlichtDevice are not configured properly for this change. so how can i solve this error? thanks!
tutorial 04 movement
-
- Posts: 13
- Joined: Wed Oct 03, 2007 9:00 am
- Location: Milano, Italia
put
at top of myeventreceiver class prototype
Code: Select all
extern scene::ISceneNode* node;
-
- Posts: 13
- Joined: Wed Oct 03, 2007 9:00 am
- Location: Milano, Italia
no, this are linker errors, so he probably forgot to link against the lib or he's linking against the wrong lib...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
No, the problem is you forgot to define the variables device and node that he has declared extern. In a .cpp file somewhere you need to write
Now that you know what your problem is, you should _really_ avoid global variables if you can. They can cause lots of headaches.
If you insist on using globals, you should really give them names that are more unique so that you realize that you are using the globals and not a local variable with the same name. Often people prepend a g_ to the variable name to signify that it is a global.
Travis
Code: Select all
irr::IrrlichtDevice* device = 0;
irr::scene::ISceneNode* node = 0;
If you insist on using globals, you should really give them names that are more unique so that you realize that you are using the globals and not a local variable with the same name. Often people prepend a g_ to the variable name to signify that it is a global.
Travis