libpng一起在Mac OS X编译C程序 [英] Compile a C program with libpng on Mac OS X
问题描述
我有一个小工具,我用C写使用的libpng。在Linux下,我只安装的libpng-dev的和做GCC myapp.c /usr/lib/libpng.so -o的myapp。在Mac OS X中,我已经安装了X code的工具,我相信包括的libpng。我怎么联系起来反对,我需要指定png.h包括路径?
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?
推荐答案
尝试/usr/X11/include/png.h - 你会发现在../lib的库(或/ usr / X11 / lib目录)作为好。
Try /usr/X11/include/png.h - you'll find the libs in ../lib ( or /usr/X11/lib ) as well.
修改小牛不会出现这个了。您可能需要使用自制或的 MacPorts的,以便安装的libpng。
EDIT Mavericks doesn't appear to have this anymore. You may need to use homebrew or MacPorts to install libpng.
这篇关于libpng一起在Mac OS X编译C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!