问题
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 :
g++ 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 ?
回答1:
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
来源:https://stackoverflow.com/questions/39645180/sdl-library-error-cannot-find-lsdl-ttf-cannot-find-lsdl-image