Reputation: 398
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.
Upvotes: 0
Views: 209
Reputation: 326
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.
Upvotes: 1