Compiling Libpng in Windows 7 or getting a hold of Libpng12.dll (and understanding how to link .DLL in VS)

zeboidlund picture zeboidlund · Sep 1, 2012 · Viewed 10k times · Source

I've been using Libpng15 in Windows 7, but I've been getting errors in relation to the

Unresolved External _png_set_longjmp_fn error when I compile my code. I followed the directions in the aforementioned link, and while it DID compile without any errors, I wound up with a message saying that I needed libpng12.dll to continue.

So, I did some Googling for libpng12.dll...nothing came up but generic "find x.dll" websites which appeared to be scams.

I've tried reading the INSTALL docs for the libpng source code on their website, and all that I see is instructions on how to do it via Unix based systems. I tried to do this in Cygwin with no luck, so I'm kind of stuck on how to compile this library.

All in all, I'm willing to do either the compilation or just using the .dll, though the problem is that I can't find a working .dll for version 12.

Another thing I tried was downloading binaries from here, which claimed to be "libpng12 for windows". I then copied the files into my VC compiler directory, which overrode libpng15, I think. Still, when I link against it statically and run my program in VC, it says that I require the .DLL file. The libpng12.dll file was in fact a .dll.a file instead. I honestly am not sure to link these (I tried linking it statically by typing "libpng12.dll.a" in the Linker Input setting through VS).

If I can go the .dll route for libpng12, how do I do this? Where is the file? How do I link it in VS?

Any help would be appreciated, as it seems there really isn't a whole lot of information on this. Either that, or I'm just not looking properly.

Answer

Glenn Randers-Pehrson picture Glenn Randers-Pehrson · Sep 5, 2012

Look in the "projects" directory of the libpng distribution, and use one of the visual projects.