I think the problem might be in global.h.
SDL.h is simply not known there. I might be wrong though.
Probably that's why you can't define SDL surfaces there.
I'd reorganize it a little, too.
I wouldn't include all the header files in one main header.
Try to avoid that. Each cpp file should only need it's own header file and some required headers.
In that own header file you should only include the headers that are required for the declaration there.
Bad to write that as text ... I'll try to show it as code:
#ifndef GLOBAL_H#define GLOBAL_H// global.h#include <SDL/SDL.h>#include <SDL/SDL_main.h>#include <cmath>#include <cstdlib>SDL_Surface* pScrSDL_Surface* pMap;Uint8* pKeys;// ...#endif
#ifndef DRAW_H#define DRAW_H// draw.h// include main header#include "global.h"// include needed header#include "screen.h"void draw(SDL_Surface* pSurface, CScreen* pScreen);#endif
// draw.cpp// include own header#include "draw.h"// include other headers#include "object.h"void draw( SDL_Surface* pSurface, CScreen* pScreen ){ CObject* pEvilCat = new CObject(); pScreen->clear_srceen(); // ... whatever}#endif
Have not compiled that either (typos guaranteed) ... might even be a worse solution.
But I think it is better to avoid including too many headers globally.
Btw. ... how does your key array work?