You just need to specify an include path to look for the header(s).
Start by finding where SDL.h is located. I would guess it's somewhere in /usr/include, /usr/local, etc. Try: > find /usr -name SDL.h
Once you know the directory that contains it, add -I[PATH] argument to g++, where [PATH] is replaced by the directory.
Here's a made-up example: > find /usr -name SDL.h
/usr/include/asdf/SDL.h
...
> g++ -Wall -I/usr/include/asdf test.cpp -o test
...
I'm not familiar with SDL, so you may also need to include the library. You'll know this if you start getting undefined reference errors. Then once compiled, the LD_LIBRARY_PATH environment variable can be used to specify the path to the library for runtime.
man g++ for more information about GCC parameters. Note: -I, -L, and -l.
/tmp/ccMnkG2I.o: In function `main':
test.cpp:(.text+0x1f): undefined reference to `SDL_Init'
test.cpp:(.text+0x2e): undefined reference to `SDL_GetError'
test.cpp:(.text+0x63): undefined reference to `SDL_Quit'
collect2: ld returned 1 exit status
Here is my C++ code ( I just got it from an example )
So, you'll need to find its location just as before and then add a -L[PATH] and a -lSDL to the g++ command so that the linker finds the shared object.
Then to execute the program, you'll need to let the shell know where to find the shared object file. To do that set the environment variable LD_LIBRARY_PATH to [PATH].
For example, in Bash:
> export LD_LIBRARY_PATH=[PATH]
> ./test
In C-Shell:
> setenv LD_LIBRARY_PATH [PATH]
> ./test