Hey guys,
So I'm trying to get SDL2 set up on my Ubuntu machine (18.04).
I've written the following code so far
Code:
#include <stdio.h>
#include <SDL2/SDL.h>
#include <stdlib.h>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
int main()
{
SDL_WINDOW* window;
if(SDL_Init(SDL_INIT_VIDEO)!= 0){
fprintf(stderr, "Could not initialize SDL Video: %s\n", SDL_GetError());
}
window = SDL_CreateWindow("hello", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if(window == NULL) {
fprintf(stderr, "Could not create window: %s\n", SDL_GetError());
}
return 0;
}
Tried compiling using "gcc -o game game.c `sdl2-config --cflags --libs`" as well as with "gcc -o -lSDL2 game game.c". Each time it shows the same error:
error: unknown type name ‘SDL_WINDOW’; did you mean ‘SDL_LINE’?
SDL_WINDOW* window;
Please help! I've tried uninstalling and reinstalling. Thanks.