Patrick’s development blog

Compile SDL/OpenGL applications using g++

Posted in SDL / OpenGL by Patrick on February 16, 2009

This is how I compile a C++ program with SDL and the OpenGL libraries GL and GLU.

g++ -o appname opengl.cpp `sdl-config –libs –cflags` -lGL -lGLU

sdl-config –libs –cflags is used to get the library path and include path for SDL. This can be used instead of manually specifying the libraries for SDL.

Advertisements

Using SDL in Debian Linux

Posted in Linux/GNU, SDL / OpenGL by Patrick on June 10, 2008

Update the repository list and install SDL using apt.

apt-get update && apt-get install libsdl1.2-dev

For other sub libraries (optional) I used the command “apt-cache search sdl” to get the name of the rest of the dev packages. For example libsdlimage-dev or libsdlnet-dev.

Compile SDL application in g++
When I compiled my SDL_net application in Linux, this worked like a charm.

g++ -o appname file.cpp -lSDLmain -lSDL_net