mingw SDL program compile and build ok but exe not working

I compile my sdl c++ program using mingw2.05 without error. But when I try to run the exe file, it pops up a window with correct caption name and then close at once. What can I do? Any help is appreciated.

I post some of the codes here:

// Attempt to create a 640x480 window with 32bit pixels.
gScreen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);

//Initialize fonts

// If we fail, return error.
if (gScreen == NULL)
fprintf(stderr, "Unable to set up video: %s\n", SDL_GetError());

// Set Windows caption to be Finance Quiz Game
SDL_WM_SetCaption( "Finance Quiz Game", NULL );

// prepare main menu, load title image and start button
int notepad=0;
while (main_menu == 1) {

Topic archived. No new replies allowed.