Compile a C program with libpng on Mac OS X

nemophrost picture nemophrost · Mar 3, 2011 · Viewed 7.1k times · Source

I have a little utility I wrote in C that uses libpng. Under linux, I just install libpng-dev and do "gcc myapp.c /usr/lib/libpng.so -o myapp". In Mac OS X, I have the Xcode tools installed, which I believe includes libpng. What do I link against, and do I need to specify an include path for png.h?

Answer

NG. picture NG. · Mar 3, 2011

Try /usr/X11/include/png.h - you'll find the libs in ../lib ( or /usr/X11/lib ) as well.

EDIT Mavericks doesn't appear to have this anymore. You may need to use homebrew or MacPorts to install libpng.