In SDL_image.h its showing "SDL.h" No such file or directory

can anyone help i am trying to add sdl in dev c++ but its showing error again and again when i am trying to add #include <SDL_image.h> . in SDL_image.h its showing that “SDL.h” no such file or directory i am tired of solving this problem please someone help me.

Capture2

3

5

did i done something wrong in process or its bug?

#include "SDL.h", as shown in SDL Image, is the way you should include SDL headers, so the answer to your question is to adjust your include paths till that works.

If you had previous code that worked by doing #include <SDL2/SDL.h> or similar, that is not the recommended way AFAIK and you should change that to also be #include "SDL.h". Unfortunately there are many tutorials out there that recommend the wrong way.

For more info see this previous answer: #include "SDL/SDL.h" Vs. #include "SDL.h&quot - #5 by Vittorio_Giovara
Or this blog post: SDL2 common mistakes and how to avoid them

1 Like

For what it’s worth, I’ve noticed on non-Windows systems the typical way to include things is by SDL2/SDL.h etc. and that it’s only Windows headers for SDL_image,_ttf, etc. that expect you to have provided an include path that directly goes to the SDL2 folder. To make things more consistent what I ended up doing typically was going through the SDL_image and SDL_ttf headers themselves and adding SDL2/ on the #include paths. I assume the Windows headers just haven’t changed to this convention because people have already set up their environments around the existing convention.

On Linux you can include "SDL.h" if you use `sdl2-config --cflags`. See the Linux FAQ.