Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<png.h> not found in mac os X mavericks

I tried (apparently successfully) to install libpng on mac os x mavericks.

I downloaded the latest 1-6-8 version .tar.xz and followed the instructions.

./configure runs fine

make check passes everything but png-error that gets skipped

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

i get the error

fatal error: 'png.h' file not found

#include <png.h>

and obviously it does not compile.

I tried installing both with homebrew and macports and it always seems to run fine, but i always get the same error

like image 664
lucarc Avatar asked Jan 06 '14 16:01

lucarc


1 Answers

First you have to find where the png.h file is located

sudo find / -name png.h

Here in my environment it is located at /usr/local/include

Then look for libpng.a

sudo find / -name libpng.a

Here in my environment it is located at /usr/local/lib

Now add those directories to the clang command line:

clang -I/usr/local/include -L/usr/local/lib -w -lz -lpng16 libpng_test.c
like image 71
Pedro Scarapicchia Junior Avatar answered Oct 04 '22 04:10

Pedro Scarapicchia Junior