SDL2_image not found

Run apt-file search SDL_image.h The result will tell you the location of the include file.

For instance, /usr/include/SDL2/SDL_image.h was returned. So, when you want to include SDL_image.h, write everything after the include/ in between < >.

Thus, includes should look like the following:

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>

See the question's comments for the original discussion regarding this solution.


From SDL documentation, it says that add 'lSDL_image' to the end of the compile line.

    cc -o myprogram mysource.o `sdl-config --libs` -lSDL_image

or

    gcc -o myprogram mysource.c `sdl-config --libs` -lSDL_image

Here is the reference -> https://www.libsdl.org/projects/docs/SDL_image/SDL_image.html Section 2.2 Compiling.

So for SDL2, you just need to change 'lSDL_image' to 'lSDL2_image'.


This problem can be solved through installing libsdl2-image-dev package:

apt install libsdl2-image-dev