Tuesday, April 28, 2009

zlib.h "_deflate", referenced from:

Just added some simple zipping capability which references zlib.h but when trying to build it, there's a set of errors resolving references from the .o (object) files. This is obviously something to do with the linking to the dynamic libraries, but it's a bugger to find out what exactly and how to solve it.

The problem is that you need to alert Xcode to the fact that you want that library loaded. The easiest solution is Project>Edit Active Target, choose the General tab, and press the + button under linked libraries. This allows you to choose from the frameworks and directories appropriate to your chosen Base SDK (see the Build tab to change this).

Of course, guessing that zlib.h and libz.dylib are related is the easy part.