When I compile my code using gcc, the link problem keep showing.
"/usr/local/include/sdl2_ttf/2.0.15/include/SDL2/SDL_ttf.h:34:10: fatal error: SDL.h: No such file or directory
34 | #include "SDL.h"
| ^~~~~~~
compilation terminated."
I have used the compile command:
gcc main.c -I /usr/local/include/sdl2/2.0.10/include -L /usr/local/include/sdl2/2.0.10/lib -I /usr/local/include/sdl2_ttf/2.0.15/include -L /usr/local/include/sdl2_ttf/2.0.15/lib -lSDL2 -lSDL2_ttf
and actually the <SDL2/SDL.h>
has been linked successfully. However, I think the problems occurred because there is no SDL.h
file in SDl2_ttf/include
file. How can I fix this problem? Thanks a lot.
Use the include directive
#include <SDL2/SDL.h>
and compile your program with
gcc main.c $(sdl-config --cflags) $(sdl-config --libs)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.