SDL2_TTF Ubuntu:/usr/bin/ld:找不到 -lSDL2_ttf

SDL2_TTF on Ubuntu: /usr/bin/ld: cannot find -lSDL2_ttf

我已经研究了几种可能的解决方案来尝试解决此问题,但我在使用 SDL_ttf 和 SDL2 绘制文本时仍然遇到以下问题。

julian@julian-linux:~/Documents/SDL/Font Demo/pt2$ make
g++ texttest.cpp -w -lSDL2 -lSDL2_ttf -LSDL2_image  -o texttest
/usr/bin/ld: cannot find -lSDL2_ttf
collect2: error: ld returned 1 exit status
Makefile:23: recipe for target 'all' failed
make: *** [all] Error 1

我的Makefile如下:

OBJS = texttest.cpp

#CC specifies which compiler we're using
CC = g++

#COMPILER_FLAGS specifies the additional compilation options we're using
# -w suppresses all warnings
COMPILER_FLAGS = -w

#LINKER_FLAGS specifies the libraries we're linking against
LINKER_FLAGS = -lSDL2 -lSDL2_ttf -LSDL2_image 

#OBJ_NAME specifies the name of our exectuable
OBJ_NAME = texttest

#This is the target that compiles our executable
all : $(OBJS)
    $(CC) $(OBJS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)

在此先感谢您的帮助。

我通过 运行

解决了这个问题
sudo apt-get install libsdl2-ttf-dev

我之前尝试用

修复它
sudo apt-get install libsdl-ttf2.0-dev