The SDL2 development package isn't installed. A runtime-only package isn't enough: the linker needs libSDL2.so. Install libsdl2-dev (Debian/Ubuntu) or SDL2-devel (Fedora), or run brew install sdl2 on macOS. For -lSDL2_image, the packages are libsdl2-image-dev, SDL2_image-devel, sdl2_image (Arch) and sdl2_image (Homebrew).
cannot find -lGL
Install libgl-dev (Debian/Ubuntu) or mesa-libGL-devel (Fedora).
undefined reference to SDL_Something
The name may be a C macro rather than a function (SDL_LoadBMP is one). Check the header and call the underlying function. See Runtime bindings.
macOS: undefined symbols: _glClear and friends
Add -clibs "-framework OpenGL", or use scripts/build-macos.sh.
error while loading shared libraries: libSDL2-2.0.so.0
SDL2's runtime library isn't installed on the machine running the program. Install libsdl2-2.0-0 (Debian/Ubuntu) or sdl2-compat (Arch).
SDL_Init failed: No available video device
There's no display. Over SSH, run on the machine itself or use X forwarding. On WSL2, update WSL (wsl --update) so WSLg is available. For automated tests, SDL_VIDEODRIVER=offscreen runs without a display.
The window opens and immediately says it's not responding
The loop isn't draining events. Call SdlPumpEvents() (or SDL_PollEvent in a loop) every frame.
Keyboard does nothing
The window needs focus, so click it. SDL_GetKeyboardState only updates when events are pumped.
SDL_GL_CreateContext failed
The driver can't provide OpenGL 3.3 core. Run glxinfo -B (Linux) to see what you have. Virtual machines and old WSL versions often top out lower. Software rendering with Mesa (LIBGL_ALWAYS_SOFTWARE=1) supports 3.3 and up.
OpenGL window is black
Check the terminal for a shader compile or link error. The demo prints them. Also check that the vertex attribute layout matches the shader's locations and that the matrix is column-major.