I need some help adding libraries in C

Question:
Hello, can somebody help or show me how to add the SDL_ttf library to this repl. If you can it would much appreciated. I have tried to use install-pkg libsdl2-ttf-dev but it dosen’t seem to work
Repl link:
https://replit.com/@Maaz25/Pokemon-battle-sim-with-graphics#main.c

Move your repl to a new C repl
On the files tab, click on the three dots in top right > show hidden files
Add pkgs.SDL_ttf to the deps array in the file replit.nix

1 Like

Thank you for your reply but how do I access the library once added to repl? do I just do #include "SDL2/SDL_ttf.h" ,is it automatically included as a header or do I have to mess with the Makefile to include the SDL flags? When I try doing #include SDL2/SDL_ttf.h it says fatal error: "SDL.h" file not found

My current CFLAGs look like override CFLAGS += -g -Wno-everything -pthread -lm -lSDL2 -lSDL2_image -lSDL2_ttf

I believe I have it working with override CFLAGS += -g -Wno-everything -pthread -lm -I/nix/store/i8yhzspzcfhasp2drclzcx69ll764i4n-SDL2-2.0.14-dev/include/SDL2 -L/nix/store/nli3cgripsmk1fjabb81arsgz8437g54-SDL2-2.0.14/lib -Wl,-rpath,/nix/store/nli3cgripsmk1fjabb81arsgz8437g54-SDL2-2.0.14/lib -Wl,--enable-new-dtags -lSDL2 -lSDL2_image -lSDL2_ttf

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.