我正在尝试用我的项目编译ZipArchive。我导入了所有源文件,包括minizip文件,我不知所措以了解这些错误。我尝试了其他十多种方法将压缩/解压缩合并到我的iphone项目中,但都没有成功。 ZipArchive似乎是最好的库,这个问题似乎是一个简单的build设置配置问题,但我无法弄清楚。

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

最佳答案

我有完全一样的问题。我将Xcode 4.4用于iOS 5.1。
我这样解决了:

  • 删除所有ZipArchive-files incl。项目中的Minizip文件夹-移至废纸.。
  • 重新添加ZipArchive文件和Minitip文件夹,并确保您选择“为任何添加的文件夹创建组”而不是“为任何添加的文件夹创建文件夹引用”选项。
  • (如果使用ARC),则将“-fno-objc-arc”选项添加到所有“构建阶段”->“编译源ZipArchive-Items”中。

  • 就是这样-祝你好运。

    10-08 05:09