🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Globals between files
Strangle enough this has never come up in my programming til now. Is there anyway I can use globals between .cpp files? For example, I have a file with multiplayer game logic and another file with singleplayer logic and a last file called main where everything is controlled from. Is there anyway I can get the globals decalred in main to work in the functions decalred in the gamelogic files or do I just have to bite the bullet and pass everything through with pointers/references?
http://kickme.to/BallisticPrograms
/* Alpha.cpp */unsigned int AlphaVal;/* Alpha.h */#ifndef INC_ALPHA_HEADER#define INC_ALPHA_HEADERextern unsigned int AlphaVal;#endif/* Beta.cpp */#include "Alpha.h"int Something(void) { AlphaVal = 5;}
Works with functions too.
[Resist Windows XP''s Invasive Production Activation Technology!]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement