I have started to make a game in C++ with SDL. My Code is:
main.cpp
#include "SDL/SDL.h"
#include "gameSystem.h"
int main(int argc, char *args[])
{
gameSystem systemHandler;
SDL_Surface *buffer;
SDL_Event event;
while(event.type != SDL_QUIT)
{
SDL_PollEvent(&event);
SLD_Flip(buffer);
}
}
gameSystem.cpp
#include "SDL/SDL.h"
#include "gameSystem.h"
gameSystem::gameSystem()
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_WM_SetCaption("GameName", NULL);
SDL_Surface *buffer;
bool fullscreen = false;
if (fullscreen == true)
{buffer = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE | SDL_FULLSCREEN);}
else
{buffer = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);}
}
gameSystem::~gameSystem()
{
SDL_Quit();
}
gameSystem.h
class gameSystem
{
public:
gameSystem();
~gameSystem();
private:
SDL_Surface *buffer;
};
My linker options include: -lmingw32 -lSDLmain -lSDL -lwinmm -sdl_Mixer
I get the following error: “error: ‘SLD_Flip’ was not declared in this scope” on line 12 of main.cpp.
All the other SDL functions seem to be fine.
Does anyone know how to fix this problem?
You misspelled it. It should be
SDL_Flip, notSLD_Flip.Also, you haven’t initialized your variable
bufferinmain. You are not setting its value inside ofgameSystem::gameSystem(); the variable is out of scope.