On Jun 13, 2005, at 9:55 AM, Michael Hanna wrote: Hi all, I'm compiling with libpng, which has been installed in /usr/local/lib . After turning ZeroLink off(by changing the active configuration), I get these errors at build time:
/usr/bin/ld: Undefined symbols: _png_create_info_struct _png_create_read_struct _png_destroy_read_struct _png_get_IHDR _png_init_io _png_read_png _png_set_sig_bytes _png_sig_cmp collect2: ld returned 1 exit status
I then tried adding to project get info -> build -> Library Search Paths -> /usr/local/lib
did a Clean, then Build, but I get the same results. I have #include <png.h> of course.
How do I get the compiler to find these libraries with XCode? XCode 2.1, 10.4.1
You don't seem to actually be linking with libpng:
- when using ZeroLink, you don't link at all, so not getting link errors is expected - Adding a Library Search Path for /usr/local/lib tells Xcode where to look for libraries you specify for linking, but it doesn't indicate which ones - #including a header file tells the compiler to compile with headers, but doesn't tell the linker anything
You need to choose Add to Project, type /usr/local/lib, find libpng, and click OK. Then check the target(s) you want to link to that library and click Add.
Chris |