Publishing excerpts from my 2nd ebook
I’m changing horses in midstream so this won’t appear as it’s been done so far. Rather than let it go to waste, I’ll be publishing it in parts here. My next book will be Learn C Games Programming on the Raspberry Pi.
Installing SDL2 on Ubuntu/Debian
The SDL2 library is an open source library available from the libsdl.org website. However in Ubuntu it’s fairly easy to install. We do need not just the binary files but the headers so we can include them.
On Ubuntu (and Debian system) the apt tool maintains a cache of files. You can search these from a terminal with this command.
apt-cache search libsdl2
On my PC this output.
libsdl2-2.0-0 – Simple DirectMedia Layer
libsdl2-dev – Simple DirectMedia Layer development files
libsdl2-doc – Reference manual for libsdl2
libsdl2-gfx-1.0-0 – drawing and graphical effects extension for SDL2
libsdl2-gfx-dev – development files for SDL2_gfx
libsdl2-gfx-doc – documentation files for SDL2_gfx
libsdl2-image-2.0-0 – Image loading library for Simple DirectMedia Layer 2, libraries
libsdl2-image-dev – Image loading library for Simple DirectMedia Layer 2, development files
libsdl2-mixer-2.0-0 – Mixer library for Simple DirectMedia Layer 2, libraries
libsdl2-mixer-dev – Mixer library for Simple DirectMedia Layer 2, development files
libsdl2-net-2.0-0 – Network library for Simple DirectMedia Layer 2, libraries
libsdl2-net-dev – Network library for Simple DirectMedia Layer 2, development files
libsdl2-ttf-2.0-0 – TrueType Font library for Simple DirectMedia Layer 2, libraries
libsdl2-ttf-dev – TrueType Font library for Simple DirectMedia Layer 2, development files
We’ll eventually need libsdl2, libsdl2-image for graphics support and libsdl2-mixer for sounds. We’ll also need libsdl2-dev so let’s start with that. Run this command . It will probably ask for your password.
sudo apt-get install libsdl2-dev
That downloaded and installed 73 MB of files. More to follow