Search code examples
windowsloadpngsdl-2sdl-image

SDL_Image IMG_Load fails on png with: "Failed loading libpng16-16.dll:"


Whenever I try to load a PNG using SDL_Image's IMG_Load function it gives the error Failed loading libpng16-16.dll:. I have all the right dll's in the right path and I can use other parts of SDL_Image, but for some reason it can't load the libpng dll. How can I fix this? Any help is appreciated.


Solution

  • See my article "SDL2: Loading Images with SDL_image":

    If you're going to run from Visual Studio, make sure the image is in the same folder as your main.cpp file; otherwise if you're running straight from the executable, the image should be in the same folder with it.

    Needless to say, what I wrote about the image here goes for the DLLs as well.