Update: These were written for my students while my role was a PAL (Peer Assisted Learning) Leader for my course, it is meant to be a simple how to on how to setup SDL2. I’m not sure if it teaches the ‘correct’ way, but I had trouble figuring this stuff out when I started so I decided to help them out. I’ve decided to keep it up just incase someone else will find it handy. It only covers Linux installation as it is only required that the class can setup their development environment on the university lab machines.


Install SDL2:

Download the .tar.gz file from the SDL2 download page.
$ mkdir -p ~/src   # It's good to keep all your source code in a consistent place
$ mv ~/Downloads/SDL2-2.0.3.tar.gz ~/src
$ cd ~/src
$ tar xvf SDL2-2-0.3.tar.gz
$ cd SDL2-2-0.3/"
$ ./configure           # Check dependencies and generate Makefile
$ make                  # Compile the library            
$ sudo make install     # Install the library

Install SDL2 image:

Download the .tar.gz file from the SDL2 image download page.
$ mv ~/Downloads/SDL2_image-2.0.0.tar.gz ~/src
$ cd ~/src
$ tar xvf SDL2_image-2-0.0.tar.gz
$ cd SDL2_image-2-0.0/
$ ./autogen.sh   # This may not be necessary, but it is sometimes required 
$ ./configure
$ make
$ sudo make install

Command Line Usage:

$ gcc mysdlprog.c -o sdlprog -lSDL2 -lSDL2_image $(sdl2-config --cflags --libs)

Note for 1st years
Jon has already setup your assignment .pro file to check sdl2-config, you don’t need to modify it once SDL is installed.