Thats because input.cpp there is no declaration that arrow_angle exists, try adding this...
extern float arrow_angle;
above the declaration of InputKeyPresses(), or better still put it in bat.h and include bat.h in input.cpp.
Hope thats helpful
X2K
btw: the extern means that it is declared...somewhere (in this case in bat.cpp)
Pointers: what's the point?
arrow_angle is defined as a float... so why are you trying to point an integer pointer at it ???
arrow_angle is probably not visible in the file input.cpp
Declare it like this in input.cpp
extern float arrow_angle;
Or use header files.
Look up variable scope in a basic C++ book for more information.
And since arrow_angle is still global you don''t need to declare a pointer to it!?!
Make a Bat class instead and put the variable there.
Good Luck,
Patrik
Declare it like this in input.cpp
extern float arrow_angle;
Or use header files.
Look up variable scope in a basic C++ book for more information.
And since arrow_angle is still global you don''t need to declare a pointer to it!?!
Make a Bat class instead and put the variable there.
Good Luck,
Patrik
This just goes back to my main argument about what the point of pointers is. I now know its advantages but in this case, it seems like you are suggesting I keep it as a global variable (which is how I had it before and it worked fine). I have declared it in a header file called global_vars.h, which I use for all global variables. Should I keep it as a global variable?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement