我已经研究了几种可能的解决方案来尝试解决此问题,但是在使用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
Run Code Online (Sandbox Code Playgroud)
我的程序如下:
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <cmath>
#include <iostream>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#define down 0
#define left 1
#define up 2
#define right 3
//Screen dimension constants
const int SCREEN_WIDTH = 600;
const int SCREEN_HEIGHT …
Run Code Online (Sandbox Code Playgroud)