working with multi files

hi guys.

i m trying to make a simple space shooter game so i can learn and have experience on some programming stuffs.

but i have problems with global variables.

global_variables.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
struct keysForSS
{
    bool down = false;
    bool up = false;
    bool left = false;
    bool right = false;
    bool quit = false;
    bool shoot = false;
};

extern fge::CSystems sysMain;
extern fge::CWindow winMain;
extern fge::CInput inpMain;
extern fge::CStates *stateMain;
extern fge::CFont fntMain;

extern std::string myAlphabet;

extern keysForSS keysMain;

extern void resetKeys();

extern int currentState;

enum STATE
{
    QUIT,
    MENU,
    LEVEL1
};


the stuffs named under fge namespace is classes i use.

ok this is the code. and what i want is using the same variables without recreating them or such. at everystate of my program they will stand and all files(.cpp) will use the same not their own defined or created.

i found this answer http://stackoverflow.com/questions/1433204/how-do-i-share-a-variable-between-source-files-in-c-with-extern-but-how

although he teachs very good i could not find a way to get what i want

what should i do
ok. i found out that i was making a mistake
Topic archived. No new replies allowed.