Why is this undeclared?

Ok i ran into some problems Dev c++ is giving me errors `Row1' undeclared (first use this function), `Row2' undeclared (first use this function), `Row3' undeclared (first use this function), `Dia1' undeclared (first use this function), `Dia2' undeclared (first use this function), heres my code and the headers where those variables ARE defined. The problem is with "drawRow1(), drawRow2(), drawRow3(), drawDia1(), drawDia2()"
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "Defines.h"
#include "SDL/SDL.h"
#include "vars.h"

void apply_surfaceClip( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL )
{
    //Holds offsets
    SDL_Rect offset;
    
    //Get offsets
    offset.x = x;
    offset.y = y;
    
    //Blit
    SDL_BlitSurface( source, clip, destination, &offset );
}

void apply_surface (int x, int y, SDL_Surface* source, SDL_Surface* destination){
    SDL_Rect offset;
    offset.x = x;
    offset.y = y;
    SDL_BlitSurface( source, NULL, destination, &offset );
}

int findSlot (int reel, int search){
    int index = -1;
    if (reel == 1){
       for (int a = 0; a <= 9; a++){
           if (reel_1.slots[a] == search){
              index = a;
              a + 9;
              }
           }
       return index;
       }
    else if (reel == 2){
         for (int a = 0; a <= 9; a++){
             if (reel_2.slots[a] == search){
                index = a;
                a + 9;
                }
             }
         return index;
         }
    else if (reel == 3){
         for (int a = 0; a <= 9; a++){
             if (reel_3.slots[a] == search){
                index = a;
                a + 9;
                }
             }
         return index;
         }
}

int drawScreen(){
    apply_surfaceClip(REEL1X, ROW1Y, reel1, Background, &reel_1.clip[findSlot(1, reel_1.current[0])]);
    apply_surfaceClip(REEL1X, ROW2Y, reel1, Background, &reel_1.clip[findSlot(1, reel_1.current[1])]);
    apply_surfaceClip(REEL1X, ROW3Y, reel1, Background, &reel_1.clip[findSlot(1, reel_1.current[2])]);
    apply_surfaceClip(REEL2X, ROW1Y, reel2, Background, &reel_2.clip[findSlot(2, reel_2.current[0])]);
    apply_surfaceClip(REEL2X, ROW2Y, reel2, Background, &reel_2.clip[findSlot(2, reel_2.current[1])]);
    apply_surfaceClip(REEL2X, ROW3Y, reel2, Background, &reel_2.clip[findSlot(2, reel_2.current[2])]);
    apply_surfaceClip(REEL3X, ROW1Y, reel3, Background, &reel_3.clip[findSlot(3, reel_3.current[0])]);
    apply_surfaceClip(REEL3X, ROW2Y, reel3, Background, &reel_3.clip[findSlot(3, reel_3.current[1])]);
    apply_surfaceClip(REEL3X, ROW3Y, reel3, Background, &reel_3.clip[findSlot(3, reel_3.current[2])]);
    apply_surface(0,0, Background, screen);
    if (SDL_Flip(screen) == -1){
       return 1;
    }
    return 0;
}

void drawRow1(){
     apply_surface(0, 0, Row1, Background);
}
void drawRow2(){
     apply_surface(0, 0, Row2, Background);
}
void drawRow3(){
     apply_surface(0, 0, Row3, Background);
}

void drawDia1(){
     apply_surface(0, 0, Dia1, Background);
}

void drawDia2(){
     apply_surface(0, 0, Dia2, Background);
}


now vars.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
extern int money;
extern int JACKPOT;
extern SDL_Surface *reel1;
extern SDL_Surface *reel2;
extern SDL_Surface *reel3;
extern SDL_Surface *Background;
extern SDL_Surface *BetButton;
extern SDL_Surface *HelpButton;
extern SDL_Surface *PrizeButton;
extern SDL_Surface *BetButtonD;
extern SDL_Surface *HelpButtonD;
extern SDL_Surface *PrizeButtonD;
extern SDL_Surface *Bet_Circle;
extern SDL_Surface *Non_Bet_Circle;
extern SDL_Surface *StopButton;
extern SDL_Surface *Text;
extern SDL_Surface *Row1;
extern SDL_Surface *Row2;
extern SDL_Surface *Row3;
extern SDL_Surface *Dia1;
extern SDL_Surface *Dia2;
extern SDL_Surface *screen;
extern SDL_Rect clip[12];
extern reel reel_1;
extern reel reel_2;
extern reel reel_3;
You have to declare the variables you have extern'd somewhere normally.
they are defined in main.cpp
Topic archived. No new replies allowed.