这个问题快把我逼疯了,我不知道怎么解决它。

    Undefined symbols for architecture armv7:
  "_deflateEnd", referenced from:
      -[ASIDataCompressor closeStream] in ASIDataCompressor.o
  "_OBJC_CLASS_$_ASIDataDecompressor", referenced from:
      objc-class-ref in ASIHTTPRequest.o
  "_deflate", referenced from:
      -[ASIDataCompressor compressBytes:length:error:shouldFinish:] in ASIDataCompressor.o
  "_deflateInit2_", referenced from:
      -[ASIDataCompressor setupStream] in ASIDataCompressor.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

我认为这与:

ld: symbol(s) not found for architecture armv7

但是我添加了:libz.1.2.3。Dylib并没有帮助,有人有什么想法吗?


当前回答

If you're building from Unity3D 5 and also using a Prime31 plugin and you're getting this error it's probably due to a duplicate .dll. If you look through your warnings in Unity's editor one of them will tell you this and warn that it could cause build errors. To see if this is the case, type P31 in your project search field and it should pop right up, maybe even more than one. The duplicate's will have a ' 1' at the end of the file name. This is probably caused from updating the plugin in editor via the store or the Prime31 menu tab.

其他回答

当我试图编译一个将“c++标准库”的目标构建设置设置为“libc++”的项目时,我收到了“架构armv7的未定义符号:”错误(必要的,因为项目使用了c++ 11的一些功能),并且该项目包括一个具有相同设置设置为“libstdc++”的子项目(或编译器默认值,因为它目前)。

将子项目的“c++标准库”设置更改为libc++可以修复这个问题,但前提是首先将子项目的部署目标设置为5.0或以上(5.0对于libc++是必要的)。

当我使用admob库时,我也有同样的问题,我修复了它将“架构”更改为“标准架构armv7, armv7s”,而不包括64位。

我遇到了类似的问题,我必须在每个项目配置(调试、发布和部署)和目标的构建设置中检查“仅构建活动体系结构”。

如果你正在处理iOS5升级,我发现要编译一个目标4.3的项目,我可以将libz.1.2.3重命名。dynlib的项目导航到libz.1.2.5。Dynlib和它编译。

我的iPhoneOS50SDK/usr/lib文件夹没有libz.1.2.3。Dynlib——不知道它是测试版还是自然升级。

目标->构建设置-> Apple LLVM编译语言: 将“c++语言方言”和“c++标准库”设置为编译器默认值有助于解决这个问题。