0

My SDL2 window does not show. I am using a command line gcc compiler. Here is my code:

#include "SDL2/SDL.h"
#include <stdio.h>
#include <stdlib.h>

int main(){
    SDL_Window* screen;
    SDL_Init(SDL_INIT_EVERYTHING);
    atexit(SDL_Quit);
    screen = SDL_CreateWindow("Quiz Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 400, 400, SDL_WINDOW_RESIZABLE);
    SDL_Delay(10000);
    SDL_DestroyWindow(screen);  
    return 0;
}

What am I doing wrong?

note: The program works on debian.

novice
  • 400
  • 1
  • 6
  • 13
  • Do you have a version of the SDL library for that environment? – Jongware Nov 30 '14 at 23:24
  • Have a look at http://stackoverflow.com/questions/11976084/why-sdl-defines-main-macro - you need to use a main which matches SDLs template. – cup Dec 04 '14 at 12:57

1 Answers1

1

You need to start an event loop - or else SDL won't communicate properly with the operating system. Check out the SDL2 section on this web page for some sample code.

moosingin3space
  • 326
  • 2
  • 5