Closed mattmaniak closed 5 months ago
SDL2_ttf's headers depend on SDL2's headers, so you need to add the include path of SDL2 as well.
Changing the source file to
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
and command to
gcc ttf_included.h -I /opt/homebrew/Cellar/sdl2/2.30.3/include -I /opt/homebrew/Cellar/sdl2_ttf/2.22.0/include
produces the same issue.
All SDL2 satellite libraries include SDL2 headersas "SDL.h"
, which means you need to add the path that contains SDL.h.
In your case: -I /opt/homebrew/Cellar/sdl2/2.30.3/include/SDL2
If you get homebrew pkg-config (or pkgconf) working, you can do the following instead:
gcc ttf_included.h $(pkg-config --cflags --libs sdl2 SDL2_ttf)
Thanks! -I /opt/homebrew/Cellar/sdl2/2.30.3/include/SDL2
did the job.
I am unable to compile a code with SDL2_ttf (2.22.0) header included. It is installed via Brew. SDL2 version is 2.30.3.
Repro steps:
brew install sdl2@2.30.3
.brew install sdl2_ttf@2.22.0
.ttf_included.h
: