Hi all
I am wondering how to get this thing working. I have finished implementing a shoot function(void shoot()) but , when I try to use it in my code by just using 'shoot()' I get this error:
main.cpp(248) : error C2365: 'shoot' : redefinition; previous definition was 'data variable'
main.cpp(24) : see declaration of 'shoot'
line 248 is where the opening left bracket of shoot is, line 24 is where I call shoot(). What am I doing wrong? I have examined the demo and see nothing different between mine and theirs, except theirs works.
Thanks.
How to call void functions (like shoot)
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
The error message tells you that the declaration of 'shoot' at line 24 is a 'data variable'. This code generates the same error:
I think we'll need to see your code to figure out exactly how you've managed to confuse the compiler.
Code: Select all
int shoot;
void shoot() { }
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Posts: 98
- Joined: Fri Oct 03, 2008 1:25 pm
- Location: UK
- Contact:
You need to define, then declare and then call your function, example.
try that, thats where I think you went wrong in creating an instance, defining, and calling.
Code: Select all
//create instance of shoot
void shoot();
//define the shoot funtion
void shoot()
{
//all code to shoot
}
//call function
shoot();
//end
-System error