jakeva
jakeva

Reputation: 2835

Compiling ZipArchive in XCode 4 project

I'm trying to compile ZipArchive with my project. I imported all the source files, including the minizip files and I am at a loss to understand these errors. I've tried a dozen other ways to incorporate compression/decompression into my iphone project, all with out success. ZipArchive seems to be the best library out, and this problem looks like it's a simple build settings configuration problem but I cannot figure it out.

Undefined symbols for architecture armv6:
  "_zipClose", referenced from:
      -[ZipArchive CloseZipFile2] in ZipArchive.o
  "_zipOpenNewFileInZip3", referenced from:
      -[ZipArchive addFileToZip:newname:] in ZipArchive.o
  "_unzOpenCurrentFile", referenced from:
      -[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
  "_unzGetGlobalInfo", referenced from:
      -[ZipArchive UnzipOpenFile:] in ZipArchive.o
  "_unzReadCurrentFile", referenced from:
      -[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
  "_unzOpen", referenced from:
      -[ZipArchive UnzipOpenFile:] in ZipArchive.o
  "_unzCloseCurrentFile", referenced from:
      -[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
  "_zipWriteInFileInZip", referenced from:
      -[ZipArchive addFileToZip:newname:] in ZipArchive.o
  "_zipOpenNewFileInZip", referenced from:
      -[ZipArchive addFileToZip:newname:] in ZipArchive.o
  "_unzGoToFirstFile", referenced from:
      -[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
  "_unzGetCurrentFileInfo", referenced from:
      -[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
  "_zipCloseFileInZip", referenced from:
      -[ZipArchive addFileToZip:newname:] in ZipArchive.o
  "_unzClose", referenced from:
      -[ZipArchive UnzipCloseFile] in ZipArchive.o
  "_zipOpen", referenced from:
      -[ZipArchive CreateZipFile2:] in ZipArchive.o
  "_unzGoToNextFile", referenced from:
      -[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
  "_unzOpenCurrentFilePassword", referenced from:
      -[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status

Upvotes: 8

Views: 7594

Answers (5)

user1531352
user1531352

Reputation:

I got this working by adding libz.tdb file. (Xcode 7, iOS 9). Error gone.

Upvotes: 0

Shunsuke Ichikawa
Shunsuke Ichikawa

Reputation: 1

I also fell into this same case....

But I found the following resolution.

http://travitu.hatenablog.jp/entry/2014/12/23/005037

I solved it this way:

・When you add ZipArchive-Files and the Minitip-Folder to your project, you should check "Copy items if needed" and "Create groups".

That's all.

Upvotes: 0

Dominic Sander
Dominic Sander

Reputation: 2704

I had exactly the same issue. I use Xcode 4.4 for iOS 5.1. And I solved it this way:

  1. Remove the all ZipArchive-Files incl. Minizip-Folder from your project - move to trash.
  2. Re-Add both ZipArchive-Files and the Minitip-Folder and ENSURE YOU SELECT THE OPTION "Create groups for any added folder" instead of "Create folder references for any added folder".
  3. if you use ARC, then add to all Build Phases -> Compile Sources ZipArchive-Items the option "-fno-objc-arc"

That´s it - good luck.

Upvotes: 14

sixFingers
sixFingers

Reputation: 1295

I got it working by adding "/usr/lib/libz.dylib" to the Other Link Flags in the targets section of Project settings.

It worked for me with Minizip.

Upvotes: 2

Divyang Mithaiwala
Divyang Mithaiwala

Reputation: 171

When I tried it will easily compiled with following link

http://code.google.com/p/ziparchive/wiki/PageName

I just take folder in following Form

ZipArchive 
   ZipArchive.h
   ZipArchive.mm
   minizip (Folder)

Then just drag & drop ZipArchive folder in to xCode "Classes".

Then add framework libz.1.2.3.dylib.

That's it. My code get compile without any issue.

Upvotes: 2

Related Questions