sdl problem.

i started reading some tutorials on sdl and c++ and decided to give it a go.

i ran into a problem within the first hour or so, that i cannot seem to figure out.

can you take a look on my code and tell me if i have done something wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "SDL.h"

int main( int argc, char* args[] )
{
	SDL_Init ( SDL_INIT_EVERYTHING );
	SDL_WM_SetCaption ("yay!", NULL);

	SDL_Surface *buffer;
	bool fullscreen = false;
	SDL_Event event;

	if (fullscreen == true){
		buffer = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE | SDL_FULLSCREEN);
	}
	else{
		SDL_SetVideoMode (640, 480, 32, SDL_SWSURFACE);
	}

	while ( event.type != SDL_QUIT){
		SDL_PollEvent (&event);
		SDL_Flip(buffer);
	}
    
	SDL_Quit;
	return 0;    
}
On line 24 you've missed out the parentheses. It should look like this:
SDL_Quit();
Otherwise it compiles fine and does exactly what I'd expect it to - opens a blank window and exits when you click on the window's close button.
What was the problem exactly?


umm i get this error thing pop up.

"Unhandled exception at 0x6812a1c2 in blbalbalb.exe: 0xC0000005: Access violation reading location 0xcccccccf"

it does not stand in the compiler error window, but pops up in a box. then i get to choose 1 out of two options (break or continue) if i hit break the program does not start running. if i hit continue the box closes, only to get reopened.
"Unhandled exception at 0x6812a1c2 in blbalbalb.exe: 0xC0000005: Access violation reading location 0xcccccccf"

Ouch :(
Sorry, no idea what that's about. If you can tell us your OS and compiler/IDE someone here might understand it.
Regards, keineahnung
my os is windows 7 and i am using the visual studio express 2010 compiler.
tried running it again and two error messages popped up:

warning C4551: function call missing argument list
warning C4700: uninitialized local variable 'event' used

what does that mean?
Topic archived. No new replies allowed.