Search code examples
objective-cios5automatic-ref-countingphp-ziparchive

ziparchive Objective-C arc compatible


Possible Duplicate:
error when import zlib in iOS: symbol(s) not found collect2: ld

I am working on iphone project and I need a library to extract ZIP file I found ZipArchive but it doesn't compatible with ARC and when I add -fno-objc-arc to compile files I get linker error:

Undefined symbols for architecture i386: "_inflateEnd", referenced from: _unzCloseCurrentFile in unzip.o "inflateInit2", referenced from: _unzOpenCurrentFile3 in unzip.o "_get_crc_table", referenced from: _unzOpenCurrentFile3 in unzip.o _zipOpenNewFileInZip3 in zip.o "_crc32", referenced from: _unzReadCurrentFile in unzip.o _zipWriteInFileInZip in zip.o -[ZipArchive addFileToZip:newname:] in ZipArchive.o "_inflate", referenced from: _unzReadCurrentFile in unzip.o "deflateInit2", referenced from: _zipOpenNewFileInZip3 in zip.o "_deflate", referenced from: _zipWriteInFileInZip in zip.o _zipCloseFileInZipRaw in zip.o "_deflateEnd", referenced from: _zipCloseFileInZipRaw in zip.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)


Solution

  • For the undefined symbols, you need to add libz to the linked libraries. See: error when import zlib in iphone sdk