Aaron Kreider
Aaron Kreider

Reputation: 1819

How to build and link libpng for Windows

I am trying to build and link libpng so that I can I use it with Eclipse, C++, and Windows 8.1 (64 bit).

I'm using the GCC C++ compiler with options:

-I"C:\zlib-1.2.8" -I"C:\lpng1625" -I"C:\CImg\CImg-1.7.5" -O0 -g3 -Wall -c -fmessage-length=0 -Dcimg_use_png -lpng16 -v

And the MinGW C++ linker with options:

-L"C:\lpng1625" -L"C:\zlib-1.2.8" and libraries are set to: gdi32, z, and png1625.

I've also tried variants of png16, png15, and png15.

My error message is: "Cannot find -lpng1625"

Do I need to build libpng? If so, how can I do this?

Upvotes: 2

Views: 7399

Answers (1)

Aaron Kreider
Aaron Kreider

Reputation: 1819

I got it to work by using Visual Studio 15 and the NuGet package manager.

NuGet made it very easy to install libpng (and automatically installed its dependencies including zlib). Next I included Cimg.h by adding its directory under the project properties and "Include Directories". Finally I had to install GraphicsMagick so that CImg could save PNG files. I did this by downloading the windows binary.

Upvotes: 1

Related Questions