SDL_image problems

Hello! Ive had a large problem with SDL_image on windows mingw32 (VSCode). Ive recntly installed the latest version (along with SDL itself of course).Ive put the SDL_image.h in my project’s includes, and the SDL_image.a in the same folder as the SDL2.a and SDL2main.a, that I link when compiling as follows:

gcc -o testImage.exe -IC:\i686-w64-mingw32\include -LC:\i686-w64-mingw32\lib src/testImage.c -lSDL2 -lSDL2_image

In the same folder as my exe, I have : SDL2.dll, SDL2_image.dll and libpng16_16.dll. When I compile and run a program that uses just SDL, it works perfectly fine.

Now when I run this program: imageTEst.c - , it compiles without errors. But on execution, The window appears for a quarter of second before dissapearing. As you can see, I have a file that I keep for logs, wich gives me this message:

error creating surface: Failed loading libpng16-16.dll: Specified procedure is unfindable

Ive linked a screenshot of my project structure, and as you can see, the libpng16_16.dll is indeed in the same folder as my exe. Im quite lost and Ive tried many different ways to solve this. Please help!

I’m not a Windows expert but I think your libpng DLL was probably compiled with MSVC, as opposed to your project which was all mingw judging by your post. Unfortunately I think I recall MSVC and mingw not mixing all too well on Windows. You could try sourcing a mingw version of libpng16-16.dll or compiling it yourself.