Problems with SDL2 installation

I’ve been hours on the computer trying to install and import SDL2/SDl.h, but it always says “no such file or directory”. It’s weird, because I included all of the .h files in an Include folder in the project, and also the bins and the libs, still 0 result. What should I do to properly install and fix SDl2 on my pc? To let you know, I’m using gcc 12.2.0 mingw64, with VSCode and C (I didn’t install C++ tho). The SDL version I want to install is 2.26.2. Thanks for the help.

You have to tell the compiler about your include directory, since that isn’t a system default path.

And how can I do it? Dio I also need to set any new PATH variables?

IDK about setting it in VSCode, but on the command line it’s -I/project/include, assuming you have your project like


gcc -std=c11 main.c -I/ProgettoSDL2/include -I/ProgettoSDL2/lib -Wall -lmingw32 -lSDL2main -lSDL2 -o main
This is the right directory, I checked it; this is the error:
main.c:1:10: fatal error: SDL.h: No such file or directory
1 | #include “SDL.h”
| ^~~~~~~
compilation terminated.
The problem is that SDL.h is in the folder, and in the #include syntax, it appears as an available library. Writing it like doesn’t change anything

Try #include <SDL.h> or #include <SDL2/SDL.h>

I solved the problem. I’m using the same version, but now on C++20 and VS2022, and I got no errors. I followed Lazyfoo’s tutorial. Thanks anyway man