这个问题快把我逼疯了,我不知道该怎么解决它……
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没有帮助,有人有什么想法吗?
发布于 2011-06-22 01:38:31
常见原因
“架构armv7的未定义符号”的常见原因是:
- Add the correct libraries in the _**`Link Binary With Libraries`**_ section of the _**`Build Phases`**_**.**
- If you want to add a library outside of the default search path you can include the path in the _**`Library Search Paths`**_ value in the Build Settings and add -l{library_name_without_lib_and_suffix} (例如对于libz.a,使用Build Settings.的Other Linker Flags部分的-lz)
- Open the _**`Build Phases`**_ for the correct target, expand _**`Compile Sources`**_ and add the missing `.m` files. If this is your issue please upvote [Cortex's answer below](https://stackoverflow.com/a/10170293/418715) as well.
- If you have multiple library files from your libraries vendor to include in the project you need to include the one for the simulator (i386) and the one for the device (armv7 for example).
- Optionally, you could create a [fat static library](https://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4) that contains both architectures.
原始答案:
您没有链接到正确的libz文件。如果您右键单击该文件并在finder中显示其路径,则其路径应该位于iOS sdk文件夹中的某个位置。下面是我的例子
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib
我建议删除引用,然后将其重新添加到目标的Link Binary With Libraries部分的构建阶段。
发布于 2012-04-16 15:39:49
我昨晚遇到了类似的问题,这个问题与我将一个类从Finder拖到我的Xcode项目中有关。
解决方案是转到构建阶段选项卡,然后转到编译源,并确保将类拖到列表中。
发布于 2011-12-20 07:52:55
我遇到了类似的问题,我必须在每个项目配置(Debug、Release和Deployment)和Target的Build Settings中选中"Build Active Architecture Only“。
https://stackoverflow.com/questions/6429494
复制相似问题