[英]SDL2_TTF on Ubuntu: /usr/bin/ld: cannot find -lSDL2_ttf
I've looked at several possible solutions to try to fix this, but I'm still having the following issue with drawing text with SDL_ttf and SDL2.我已经查看了几种可能的解决方案来尝试解决此问题,但是在使用 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
My Makefile is as follows:我的 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)
Thanks in advance for any help.在此先感谢您的帮助。
I solved this by running我通过运行解决了这个问题
sudo apt-get install libsdl2-ttf-dev
where as previously I tried to fix it with和以前一样,我试图用它来修复它
sudo apt-get install libsdl-ttf2.0-dev
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.