I’m trying to run a simple C++ example using the SDL library. I get a bunch of weird errors that I don’t know how to fix. An attempt to google the error did not work.
Code here. I’m trying to compile this code with this command : g++ 01_hello_SDL.cpp -w -lSDL2 -o 01_hello_SDL
Errors here.
Maybe someone else had the same problem? Or does anyone know how to fix this?
use pkg-config pkg-config --cflags --libs sdl2 or sdl2-config sdl2-config --cflags --libs. Example command: g++ 01_hello_SDL.cpp -lSDL2 -o 01_hello_SDL $(sdl2-config --cflags --libs) .
If it still doesn’t work, you could try using locate to see where the libraries are installed and add the directory using the -L flag for the compiler.
Note: if the issue still persists, telling us what distro you use and how you installed the libraries might help us to figure out the problem .