gpt4 book ai didi

c++ - Ubuntu :/usr/bin/ld: cannot find -lSDL2_ttf 上的 SDL2_TTF

转载 作者:搜寻专家 更新时间:2023-10-31 00:29:37 24 4
gpt4 key购买 nike

我已经研究了几种可能的解决方案来尝试解决此问题,但在使用 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

关于c++ - Ubuntu :/usr/bin/ld: cannot find -lSDL2_ttf 上的 SDL2_TTF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40368368/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com