Hello all,
My question is, when using Visual Studio, and compiling this piece of code:

int main(int argc, char *argv[])
{
	SDL_Init(SDL_INIT_EVERYTHING);
	SDL_SetVideoMode(640, 480, 32, SDL_OPENGL);
	SDL_WM_SetCaption("OpenGL Awesomeness", NULL);

        //run time error here
	SDL_Event event;

	while(event.type != SDL_QUIT)
	{
		SDL_PollEvent(&event);
		RenderScene();
		SetupRC();
		SDL_GL_SwapBuffers();
		SDL_Delay(60);
	}
	SDL_Quit();
	return 0;
}

I get a runtime error saying that I'm using a variable that is being used and not initialized. I know that SDL_Events cannot be initialized, and am wondering how to fix this problem. I have before, but the soultion has currently escaped me. Thank you for your help in advance,

~Asian

Try using a do...while statement. The PollEvent function is more than likely initializing the event object, so when you try to use the event object before it's been assigned anything.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.