Why does VScode say SDL.h: No such file or directory

147 views Asked by At

I have the SDL "include" folder inside my workspace, and while typing the code visual studio seems to recognize that the file exists. But whenever I try running it, I get this error: enter image description here

I have tried directly including the SDL library I downloaded, in case I was missing some files that are need for it to work. No matter what way I organise the files and the 'include' config, it refuses to recognize the file while running

1

There are 1 answers

0
László Lipódi On

While you compile your code you have to specify include directories that are different from the defaults. You can do this by compiling with the -I flag. For example: gcc main.c -o main -I./include As for Intellisense, there should be an Include Directories setting in the C/C++ extension you are using.

If you are using tasks here is what I've used for compiling my homework for my university assignment that used SDL2: Github Gist link for my tasks.json