0

For some reason when I compile my code:

class MainClass
{
public:   
    MainClass(void);
    bool init();
    bool loadMedia();
    SDL_Surface* loadSurface( std::string path );
    void gameLoop();
    ~MainClass(void);

private:
    SDL_Window* gWindow;
    SDL_Surface* gScreenSurface;
    SDL_Surface* gPNGSurface;
    SDL_Surface* gPNGSurface;

    static const int SCREEN_WIDTH = 640;
    static const int SCREEN_HEIGHT = 480;
};

the compiler gives out this error for every pointer that I have. Any advice?

error C2143: syntax error : missing ';' before '*' 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Sjon
  • 4,989
  • 6
  • 28
  • 46
yTpo
  • 11
  • 5
  • 4
    Possible duplicate of [Syntax error missing ; before \*](http://stackoverflow.com/questions/1542623/syntax-error-missing-before) – Pooja Nilangekar Oct 22 '15 at 08:14
  • Make sure that SDL_Surafce SDL_window etc. are known to your class – anurag86 Oct 22 '15 at 08:16
  • Blah - forget, just readed that at every line (At which line the error refers? To the line having "SDL_Surface* loadSurface", or later lines with pointers?) - It really sounds that you have problems with including SDL headers (compiler does not understand the types). – MaKo Oct 22 '15 at 17:46

1 Answers1

0

I'm guessing you're not including the header files for SDL_Window and SDL_Surface (I think it's SDL.h).

Andrei
  • 100
  • 2
  • 11
  • 1
    I've added SDL.h and SDL_image.h using a headed file. So I don't think that's what's causing it. – yTpo Oct 22 '15 at 08:19
  • Check this: https://stackoverflow.com/questions/32246738/where-can-i-find-the-definition-of-sdl-window – Andrei Oct 22 '15 at 08:29