I'm working on MacOSX 10.7.2 and Xcode 4.2.1. I installed libpng
using port and I was trying to load a PNG image in my application, but I get linker errors:
Undefined symbols for architecture x86_64:
"_png_create_read_struct", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_create_info_struct", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_destroy_read_struct", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_set_longjmp_fn", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_init_io", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_set_sig_bytes", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_read_png", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_get_IHDR", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_get_rowbytes", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_get_rows", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
ld: symbol(s) not found for architecture x86_64
I included png.h
in my project using
#include "/usr/X11/include/png.h"
I know libpng
is based on zlib
, thus I have included -lz
in "Other linker flags" but nothing changed.
Any suggestions on how to make it work?