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

a sandwhich picture a sandwhich · Jan 31, 2014 · Viewed 17.4k times · Source

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.

Answer

CinchBlue picture CinchBlue · Jul 3, 2015

It appears that libpng16-16.dll has a dependency on zlib1.dll for MinGW-w64 (32-bit). Try to include zlib into your dependnecies--include the DLL in the folder where the executable runs.