I'm facing a very weird problem.
This is map.h:
#define MAP_WIDTH 256
#define MAP_HEIGHT 256
typedef struct {
char exit_n;
char exit_s;
char exit_w;
char exit_e;
} room;
room map[MAP_WIDTH][MAP_HEIGHT];
void generate_map();
And this map.c:
#include "map.h"
void generate_map()
{
char room_x, room_y;
room_x = MAX_WIDTH/2;
room_y = MAX_HEIGHT/2;
// first room
map[room_x][room_y].exit_n = 1;
}
So, nothing really exotic. The problem is the compiler complaining about the two defined constants MAX_WIDTH and MAX_HEIGHT:
map.c: In function ‘generate_map’:
map.c:18: error: ‘MAX_WIDTH’ undeclared (first use in this function)
map.c:18: error: (Each undeclared identifier is reported only once
map.c:18: error: for each function it appears in.)
map.c:19: error: ‘MAX_HEIGHT’ undeclared (first use in this function)
What am I doing wrong?