体系结构i386的未定义符号:“_ OBJC_CLASS _ $ _ ZipException”,引用自:error

时间:2013-01-04 12:57:21

标签: ios objective-c xcode cocoa-touch xcode4.5

我在项目中使用了几个'.o'文件,在编译时显示以下错误,

error:linker command failed with exit code 1 (use -v to see invocation)

我已经发布了

下面的错误日志
Ld /Users/deepak/Library/Developer/Xcode/DerivedData/app-bnwpvhpbrfdurbdgxucyddqyfosh/Build/Products/Debug-iphonesimulator/app.app/app normal i386
    cd /Users/deepak/Workspace/iosDevelopement/PROJECTS/KML/app
    setenv IPHONEOS_DEPLOYMENT_TARGET 4.3
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/deepak/Library/Developer/Xcode/DerivedData/app-bnwpvhpbrfdurbdgxucyddqyfosh/Build/Products/Debug-iphonesimulator -F/Users/deepak/Library/Developer/Xcode/DerivedData/app-bnwpvhpbrfdurbdgxucyddqyfosh/Build/Products/Debug-iphonesimulator -F/Users/deepak/Workspace/iosDevelopement/PROJECTS/KML/app -filelist /Users/deepak/Library/Developer/Xcode/DerivedData/app-bnwpvhpbrfdurbdgxucyddqyfosh/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/Objects-normal/i386/app.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=4.3 -lstdc++ -licucore -lz -framework MapKit -framework CoreLocation -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -framework KML -o /Users/deepak/Library/Developer/Xcode/DerivedData/app-bnwpvhpbrfdurbdgxucyddqyfosh/Build/Products/Debug-iphonesimulator/app.app/app
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_ZipException", referenced from:
      objc-class-ref in ZipFile.o
      objc-class-ref in ZipReadStream.o
      objc-class-ref in ZipWriteStream.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

最初,有更多错误并通过导入 libs.dylib 框架来解决它们,

但仍然存在2个错误。

编辑:我已经完成了流行的问题Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error,但解决方案对我不起作用

有谁知道我哪里出错了?我是xcode的问题,任何缺少的库或链接的失败?

提前致谢

2 个答案:

答案 0 :(得分:38)

错误消息表明未定义的符号由ZipFile.oZipReadStream.oZipWriteStream.o引用。这意味着您尝试在应用中使用Objective-Zip库。

未定义的符号为_OBJC_CLASS_$_ZipException。编译器在源文件中看到@implemention ZipException指令时会生成此符号。

Objective-Zip库包含一个名为ZipException.m的文件,其中包含@implementation ZipException指令。

最可能的解释是,您根本没有在目标中加入ZipException.m。检查你是否已经这样做了。如果您不知道如何操作,请查看this answer

另一种可能的解释是,您可能会以删除ZipException.m指令或将其隐藏在编译器中的方式意外修改@implementation ZipException文件。检查您是否未修改该文件,并且该文件包含@implementation ZipException指令。

答案 1 :(得分:0)

我提供的解决方案听起来很奇怪,实际尝试它需要一段时间,但它为我做了诀窍。这仅在您修复所有框架链接问题时才有效。对我来说就是这种情况,但我仍然没有马赫-O错误。

我所做的是从链接的框架和库中删除所有库(在常规选项卡iOSTarget中),然后通过将它们从左窗格拖动到链接的框架和库空间来添加它们。