Here\'s a piece of my current Makefile:
CFLAGS = -O2 -Wall -pedantic -std=gnu++11 `sdl-config --cflags --libs` -lSDL_mixer
I have libsdl instal
the simplest idea is to add pkg-config --cflags --libs sdl2 while compiling the code.
g++ file.cpp `pkg-config --cflags --libs sdl2`