Xcode 4.2 链接错误:libz 问题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6779951/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:32:18  来源:igfitidea点击:

Xcode 4.2 link error: libz issue?

iosxcode

提问by Andrew Smith

Moving a project to Xcode 4.2, I am getting a number of Mach-O linker unresolved errors, for things like _crc32, _expf, and _UnwindSjLj_Register, on a project that compiles and links fine in Xcode 4.0.3.

将项目移至 Xcode 4.2,我在 Xcode 4.0.3 中编译和链接正常的项目中遇到许多 Mach-O 链接器未解析错误,例如 _crc32、_expf 和 _UnwindSjLj_Register。

I suspect this might be a libz issue, since my previous project linked libz.1.2.3.dylib. I removed that reference, and added libz.1.2.5.dylib, that is found in my /Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A5259f)/Symbols 1/usr/lib folder.

我怀疑这可能是 libz 问题,因为我之前的项目链接了 libz.1.2.3.dylib。我删除了该引用,并添加了 libz.1.2.5.dylib,它位于我的 /Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A5259f)/Symbols 1/usr/lib 文件夹中。

I get the same 39 unresolved references whether I include libz.1.2.5.dylib or not, so it seems very suspicious.

无论是否包含 libz.1.2.5.dylib,我都会得到相同的 39 个未解析的引用,所以这看起来很可疑。

回答by epatel

Link against the libz.dylib, but add it through the Build Phases tab.

链接libz.dylib,但通过 Build Phases 选项卡添加它。

Project >> Target >> Build Phases >> Link Binary With Libraries

项目 >> 目标 >> 构建阶段 >> 将二进制文件与库链接

Press +under the list and select the libz.dylibthen it will add the lib so it will work inbetween SDK updates.

按列表下的+并选择libz.dylib然后它会添加库,以便它可以在 SDK 更新之间工作。

回答by BobFromBris

Had a problem with this same lib - libz.1.2.3.dylib. As suggested, I added libz.dylib. still got the message "ld: Library not found for -lz.1.2.3". Removed the reference build succeeded. Tried replacing libz.dylib with libz.1.2.5.dylib and still built without error. XCode 4.3.2, Lion (OS X 10.7.4)

这个库有问题 - libz.1.2.3.dylib。按照建议,我添加了 libz.dylib。仍然收到消息“ld:未找到 -lz.1.2.3 的库”。删除参考构建成功。尝试用 libz.1.2.5.dylib 替换 libz.dylib 并且仍然没有错误地构建。XCode 4.3.2,狮子(OS X 10.7.4)

回答by prem

I had same problem. it works xcode 4.2 .when i run the app in xcode 4.5. I have this problem. libz.dylib (No such file or directory)Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1. I have tried with libz1.2.5dylib.but no use

我有同样的问题。它适用于 xcode 4.2。当我在 xcode 4.5 中运行该应用程序时。我有这个问题。libz.dylib (No such file or directory)Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1. 我试过 libz1.2.5dylib.but no用