A_Sandwich
A_Sandwich

Reputation: 97

Issue using 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?

Upvotes: 0

Views: 3231

Answers (1)

JordanDee
JordanDee

Reputation: 68

You need the development packages installed to develop SDL2 based programs.

sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-image-dev

Upvotes: 1

Related Questions