Help with simple c++ problem

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
chrono

Help with simple c++ problem

Post by chrono »

hi do someone know how to delcare a "program global" int,string...
i have some int's and string's in a cpp file but i like to use the same variables other cpp file how i do make that

pd all variables are in the same funtion
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Share the same header?
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

Surely thats breaking encapsulation, and as its been said before on here that generally makes bugs harder to track down?? Can you not just pass them as parameters??

Heres me saying all this and I have numerous statics globally available, but only through methods !!! :oops: :roll:
digfarenough
Posts: 39
Joined: Sat Oct 30, 2004 4:35 pm
Location: Boston, MA
Contact:

Post by digfarenough »

the keyword is extern.. you define the variable in, say, main.cpp normally, then in the other files you say "extern int i;" or whatever the variable's type and name are
Post Reply