I am working on MacOSX 10.7.2 and Xcode 4.2.1. I installed libpng
using the port and I tried to load the 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 that libpng
based on zlib
, so I included -lz
in the "Other linker flags", but nothing has changed.
Any suggestions on how to make it work?