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

    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并没有帮助,有人有什么想法吗?


当前回答

回到你的项目,点击Build phases, Compile sources, Add GameCenterManager。M到列表上。

其他回答

另一个可能导致“未定义符号”链接错误的原因是试图从.mm文件调用C函数。在这种情况下,您需要使用extern“C”{…}当您导入头文件时。

从objective - c++调用C-Function链接器错误

回到你的项目,点击Build phases, Compile sources, Add GameCenterManager。M到列表上。

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

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

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.

我没有在这里找到这个建议,所以它是这样的: 如果你的项目有多个目标(即一个OSX和一个iOS),那么你必须为每个目标链接相关的库。例如,在我的情况下,我需要AudioToolbox..我不得不为OSX和iOS添加一次(在框架文件夹下,你必须有每个目标的每个库的副本..如果你只看到一个..那么这就是一个危险信号)