When you see undefined reference to SDL_* it means that it is forgetting to link against the proper libraries. Your paste of the g++ line is missing -lSDL and the other appropriate libraries.
That is something you are going to have to read the code to find out. That is part of being a programmer, learning to decipher code and if you are going to use code you didn't write you have to learn how to do that otherwise you will just continue to have someone hold your hand through the whole thing and never learn anything.