SDL/SDL_image.h: No such file or directory
Solution 1
You need to install SDL_image separately. It's not shipped with SDL.
Solution 2
You need to install SDL_image library like mentioned in the other answers, if you are on a Debian based systems you can simply install with the following command:
sudo apt-get install libsdl-image1.2-dev
Solution 3
In the third tutorial of lazyfoo is completely explained.
Basically, you must add "-lSDL_image" to the compilation line.
Solution 4
In your case as you are using windows, then you should first install sdl_image
and then
#include <SDL_image.h>
not
#include <SDL/SDL_image.h>
If you were using linux and your sdl-image
package is installed to /usr/include/SDL
then you need to use
#include <SDL_image.h>
In most cases when you install from source in linux. Your package may not be resident in /usr/include/SDL
In these kind of situation, I use
#include <SDL/SDL_image.h>
and it works
Solution 5
i had same problem "error: SDL/SDL_image.h: No such file or directory", i solved this by doing this: http://wiki.codeblocks.org/index.php?title=Using_SDL_with_Code::Blocks ...look at the picture with name "Project's build options" and write things inside that red circles in my case it helped. Good luck! (sorry for bad English) :P
Comments
-
Knarf over 3 years
I'm trying to follow Lazy Foo's tutorials. But when I try to run one of his examples I get this compiler error:
error: SDL/SDL_image.h: No such file or directory
The compiler/linker is set up correctly, I'm using Code::Blocks on Windows XP.
However, the problem is simply that there are no SDL_image.h. I've checked in the folder that it supposedly should have been. I tried to download the SDL library again and checked again, still no SDL_image.h file. Where did the SDL_image.h file go?
The library I dowloaded was the 'SDL-devel-1.2.14-mingw32.tar.gz' under 'Development Libraries' for Win32 from this link: http://www.libsdl.org/download-1.2.php
-
Bit Fracture almost 9 yearsFor those who are using SDL2, the file name has changed to "SDL2_image.h". See documentation: wiki.libsdl.org/MigrationGuide#line-435
-
alok over 7 yearsOn my box, the file is located at /usr/local/include/SDL2/SDL_image.h. Essentially, requiring an import from "SDL2/SDL_image.h" and linking with -lSDL_image.
-
Hi-Angel over 6 years@BitFracture it probably depends, for me it's still
SDL_image.h
, to be exact it'sSDL2/SDL_image.h
. -
Bit Fracture over 6 years@Hi-Angel The important point here is that it might not be in the same place for everyone. Hopefully knowing this will prevent some face-palms.
-
HolyBlackCat over 3 years
SDL2_image-devel-2.0.5-VC.zip
is for Visual Studio, using it with MinGW is a bad idea. I'm surprised it worked for you at all. You should be usingSDL2_image-devel-2.0.5-mingw.tar.gz
. -
Softmixt over 3 yearsyes you are right is wrong folder sorry my bad , comment changed.
-
Phoenix over 2 yearsOn macOS, you can get this with
brew install sdl2 sdl2_image
, at least for when building Brogue CE.