tiger tiger - 8 months ago 71
C++ Question

SDL library error: cannot find -lSDL_ttf cannot find -lSDL_image

I'm running a C++ program using sdl, my ubuntu version is 16.04.
After I sudo apt-get install libsdl1.2-dev and run the following displays :


sdl-config --cflags
-g -W -Wall -Weffc++ -Wextra -pedantic -O0 main.cpp -o run generateFrames.o
sdl-config --libs
-lSDL_ttf -lSDL_image

/usr/bin/ld: cannot find -lSDL_ttf

/usr/bin/ld: cannot find -lSDL_image

collect2: error: ld returned 1 exit status

Makefile:10: recipe for target 'run' failed

make: *** [run] Error 1

How to get rid of this error ?


You only installed SDL library. SDL_image and SDL_ttf are different libraries. You can download them via sudo apt-get install libsdl-image1.2-dev libsdl-ttf2.0-dev. There is also another popular SDL extension SDL_mixer: libsdl-mixer1.2-dev