问题描述
我尝试(显然成功)在Mac OS X小牛上安装了libpng
.
I tried (apparently successfully) to install libpng
on mac os x mavericks.
我下载了最新的1-6-8版本.tar.xz
,并按照说明进行操作.
I downloaded the latest 1-6-8 version .tar.xz
and followed the instructions.
./configure
运行正常
make check
传递除png错误之外的所有错误
make check
passes everything but png-error that gets skipped
sudo make install
显然可以正常工作.出现.
sudo make install
apparently works fine since my library libpng. appears.
现在,当我尝试使用字符串
Now, when i try to compile the C file that i need to compile, using the string
clang -w -lz -lpng16 libpng_test.c
我得到了错误
fatal error: 'png.h' file not found
#include <png.h>
很显然它不能编译.
我尝试同时使用homebrew和macports进行安装,但它似乎总是可以正常运行,但是我总是遇到相同的错误
I tried installing both with homebrew and macports and it always seems to run fine, but i always get the same error
推荐答案
首先,您必须找到png.h文件所在的位置
First you have to find where the png.h file is located
sudo find / -name png.h
在我的环境中,它位于/usr/local/include
Here in my environment it is located at /usr/local/include
然后寻找libpng.a
Then look for libpng.a
sudo find / -name libpng.a
在我的环境中,它位于/usr/local/lib
Here in my environment it is located at /usr/local/lib
现在将这些目录添加到clang命令行中:
Now add those directories to the clang command line:
clang -I/usr/local/include -L/usr/local/lib -w -lz -lpng16 libpng_test.c
这篇关于< png.h>在Mac OS X特立独行者中找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!