Here is your problem:
Code:
int main(int nNumberofArgs, char* pszArgs[])
{
if(SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Could not initialize SDL: %s\n",
SDL_GetError());
return -1;
}
You missed a ending
} for your if() statement.
This should be better:
Code:
int main(int nNumberofArgs, char* pszArgs[])
{
if(SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Could not initialize SDL: %s\n",
SDL_GetError());
return -1;
}
return 0;
}
Altho the ending part of it, dosn't make any sence
Code:
atexit(SDL_Quit);
SDL_Surface* screen;
screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE|SDL_ANYFORMAT);
if( !screen ) {
fprintf(stderr, "Couldn't create a surface: %s\n",
SDL_GetError());
return -1;
}
is left floating in mid air. You are not allowed to have an if() statement standing alone, it must be encapsulated by some form of function, from where you can activate that code in the simple function call elsewhere in your code. If I were you, I would merge that with the main() function, so entire code would be something like this:
Code:
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <SDL/SDL.h>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
if(SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Could not initialize SDL: %s\n",SDL_GetError());
return -1;
}
atexit(SDL_Quit);
SDL_Surface* screen;
screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE|SDL_ANYFORMAT);
if( !screen ) {
fprintf(stderr, "Couldn't create a surface: %s\n", SDL_GetError());
return -1;
}
return 0;
}