I write some code for just empty window in SDL2.
#include <SDL2/SDL.h>
int main(int argc, char ** arg){
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Window * win = SDL_CreateWindow("title", 30, 30, 600, 500, SDL_WINDOW_SHOWN);
SDL_Surface * screen = SDL_GetWindowSurface(win);
SDL_Delay(2000);
SDL_DestroyWindow(win);
SDL_Quit();
}
I am in Arch-based Linux (manjaro gnome). I downloaded all files with SDL2 from package manager (smaller AUR). And I think I need to add something to root folder where my main.cpp. But where I need to search this files? I don't find tutorials for SDL2 on arch linux. I am working in VSCode and I just make one file main.cpp. Hello world in C++ is working so it's not problem in C++ installation. If you need error.
/usr/bin/ld: /tmp/ccq0QfEp.o: in function «main»:
main.cpp:(.text+0x15): indefinite link «SDL_Init»
/usr/bin/ld: main.cpp:(.text+0x3f): indefinite link «SDL_CreateWindow»
/usr/bin/ld: main.cpp:(.text+0x4f): indefinite link «SDL_GetWindowSurface»
/usr/bin/ld: main.cpp:(.text+0x5d): indefinite link «SDL_Delay»
/usr/bin/ld: main.cpp:(.text+0x69): indefinite link «SDL_DestroyWindow»
/usr/bin/ld: main.cpp:(.text+0x6e): indefinite link «SDL_Quit»
collect2: error: ld returned 1 exit status