Pregunta

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

¿Fue útil?

Solución

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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top