Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save navanshu/3d211c7c056967a0f85458cc2f778f51 to your computer and use it in GitHub Desktop.
Save navanshu/3d211c7c056967a0f85458cc2f778f51 to your computer and use it in GitHub Desktop.
How do I install SDL on ubuntu?

What you need to do to install SDL is:

#install sdl2
sudo apt install libsdl2-dev libsdl2-2.0-0 -y;

#install sdl image
sudo apt install libjpeg-dev libwebp-dev libtiff5-dev libsdl2-image-dev libsdl2-image-2.0-0 -y;

#install sdl mixer
sudo apt install libmikmod-dev libfishsound1-dev libsmpeg-dev liboggz2-dev libflac-dev libfluidsynth-dev libsdl2-mixer-dev libsdl2-mixer-2.0-0 -y;

#install sdl true type fonts
sudo apt install libfreetype6-dev libsdl2-ttf-dev libsdl2-ttf-2.0-0 -y;

use

`sdl2-config --cflags --libs` -lSDL2 -lSDL2_mixer -lSDL2_image -lSDL2_ttf

to link them, for example:

g++ myProgram.cpp -o myProgram `sdl2-config --cflags --libs` -lSDL2 -lSDL2_mixer -lSDL2_image -lSDL2_ttf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment