Issues finding the location of package: libsdl2-image-2.0-0

Recently I've been playing around with the SDL library and wanted to start using libsdl2-image-2.0-0 along with SDL. I have been trying to get this working with Ubuntu 15.04. I have installed the package using

sudo apt-get install libsdl2-image-2.0-0

The installation appeared to go completely fine but when I try to include the image library in my C++ code with

#include <SDL2/SDL_image.h>

I get an error "fatal error: SDL2/SDL_image.h: No such file or directory" I went and looked where the SDL2 base library was located /usr/local/include/SDL2 and just as the error message said SDL_image.h was not there. I then tried to figure out where the library was using

apt-file search SDL_image.h

When I do this

libsdl-image1.2-dev: /usr/include/SDL/SDL_image.h
libsdl2-image-dev: /usr/include/SDL2/SDL_image.h

both show up as results. This is strange to me since I did not install libsdl2-image-dev. Also when I try to view /usr/include/SDL2/ the folder doesn't even appear to exist which just adds to my confusion.

I then tried to remove libsdl2-image-dev so I could install libsdl2-image-2.0-0 but when I run the command

sudo apt-get remove libsdl2-image-dev

I get

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libsdl2-image-dev' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

and when I try to run the command

sudo apt-get install libsdl2-2.0-0

I end up getting

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libsdl2-2.0-0 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

So basically I cannot locate where this library is and so I can't properly link it to my code. Is there a more reliable way to locate where this library is and is there something fundamental I am not understanding in regards to using these supplementary libraries?


This is strange to me since I did not install libsdl2-image-dev. Also when I try to view /usr/include/SDL2/ the folder doesn't even appear to exist which just adds to my confusion.

apt-file searches the contents of available packages using a database, so it is hardly a surprise that it showed a package which you hadn't installed.

I then tried to remove libsdl2-image-dev so I could install libsdl2-image-2.0-0

Why do you think you have to remove one to install the other, especially when you have already installed it?

is there something fundamental I am not understanding in regards to using these supplementary libraries?

Yes. foo and foo-dev can coexist. If you are a developer, you will probably need both to be installed. foo-dev often depends on foo, so installing it forces foo to be installed as well. In particular, libsdl2-image-dev depends on libsdl2-image-2.0-0.


To conclude, just install the -dev package:

sudo apt-get install libsdl2-image-dev