gpt4 book ai didi

objective-c - ld : library not found for -lz

转载 作者:可可西里 更新时间:2023-11-01 03:47:57 27 4
gpt4 key购买 nike

这让我发疯,当我尝试在模拟器上编译时,一切正常,但在设备上我遇到了这个错误:

ld: library not found for -lz
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1

请帮助我了解问题的根源:

    Ld /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos/Fontenay-sous-Bois.app/Fontenay-sous-Bois normal armv7
cd /Users/ZConsulting/Desktop/Fontenay-sous-Bois
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products
/Debug-iphoneos -F/Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
/iPhoneOS5.0.sdk/Developer/Library/Frameworks -filelist /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Intermediates/Fontenay-sous-Bois.build/Debug-iphoneos/Fontenay-sous-Bois.build/Objects-normal/armv7/Fontenay-sous-Bois.LinkFileList -dead_strip -fobjc-arc -miphoneos-version-min=5.0 -framework SenTestingKit -lz -lz.1.1.3 -framework MobileCoreServices
-framework SystemConfiguration -framework CFNetwork -framework CoreLocation -framework MapKit -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos/Fontenay-sous-Bois.app/Fontenay-sous-Bois

编辑:

我确实导入了 libz.1.1.3.dylib 框架: enter image description here

我在链接框架中得到的唯一 libz 是 libz.1.1.3.dylib enter image description here

最佳答案

您确实在 Linked frameworks and Libraries 项中指定了库 libz.dylib 而不是直接引用 libz.1.1.3 - 通常,您应该使用最通用的库版本进行编译,而不是更具体的版本

其次,确保 libz.dylib 存在于 iOS SDK 下 - 如果它丢失,则可能是错误安装的 SDK(重新安装应该可以解决这个问题)。

find /Developer/Platforms -name libz.dylib

应该为 iPhoneOS5.0.sdk 下的 libz.dylib 产生非空输出

另请参阅 iPhone - Linker Error in Xcode 4.2 Preview 的答案,这是一个类似的问题。

关于objective-c - ld : library not found for -lz,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9803702/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com