View Single Post
Old 07-22-2005, 12:47 PM   #1 (permalink)
slashdot
Registered User
 
Join Date: Dec 2004
Posts: 43
slashdot is on a distinguished road
SDL program problem...

This program doesn't compile right... I believe its because it doesn't have a proper return 0; at the end. But when I put it at the end, it gives me the same error. (error at bottom)
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;
}
Quote:
ERROR:
anyone@george's:~$ g++ -s SDLBLECH.cpp -o SDLBLECH `sdl-config --libs --cflags`
SDLBLECH.cpp: In function `int main(int, char**)':
SDLBLECH.cpp:26: error: parse error at end of input
anyone@george's:~$
How would I fix this problem? I am just playing with SDL to understand it better, just if you want to know what I was doing.
slashdot is offline   Reply With Quote