简体   繁体   中英

Compile a C program with libpng on Mac OS X

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM