ios 架构 i386 的未定义符号:“_OBJC_CLASS_$_ZipException”,引用自:错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14157632/
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-08-30 21:43:49  来源:igfitidea点击:

Undefined symbols for architecture i386: "_OBJC_CLASS_$_ZipException", referenced from: error

iosobjective-cxcodecocoa-touchxcode4.5

提问by D_D

I'm using a few '.o' files in my project and while compiling it shows the following error,

我在我的项目中使用了一些“.o”文件,在编译它时显示以下错误,

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

I had posted the error log below

我在下面发布了错误日志

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)

Initially, there were more errors and solved them by importing libs.dylibframework,

一开始错误比较多,通过导入libs.dylib框架解决,

but still 2 errors persists.

但仍然存在 2 个错误。

EDIT: I had already gone through the popular question Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error,but the solution doesn't work for me

编辑:我已经完成了架构 i386 的未定义符号的流行问题:_OBJC_CLASS_$_SKPSMTPMessage",引用自:错误,但该解决方案对我不起作用

Does anyone know where I had gone wrong? I s that a problem with xcode, any missing libraries or failure in linking something?

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

Thanks in advance

提前致谢

回答by rob mayoff

The error message says that the undefined symbol is referenced by ZipFile.o, ZipReadStream.o, and ZipWriteStream.o. This implies that you're trying to use the Objective-Ziplibrary in your app.

该错误消息说,未定义的符号被引用ZipFile.oZipReadStream.oZipWriteStream.o。这意味着您正在尝试在您的应用程序中使用Objective-Zip库。

The undefined symbol is _OBJC_CLASS_$_ZipException. The compiler generates this symbol when it sees the @implemention ZipExceptiondirective in a source file.

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

The Objective-Zip library includes a file named ZipException.m, which contains the @implementation ZipExceptiondirective.

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

The most likely explanation is that you simply haven't included ZipException.min your target. Check that you have done so. If you don't know how, look at this answer.

最可能的解释是你根本没有包括ZipException.m在你的目标中。检查您是否已这样做。如果你不知道怎么做,看看这个答案

Another possible explanation is that you have modified the ZipException.mfile, perhaps accidentally, in a way that removes the @implementation ZipExceptiondirective or hides it from the compiler. Check that you have not modified the file, and that it contains the @implementation ZipExceptiondirective.

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

回答by GrandSteph

The solution I am providing will sound odd and it took a while for me to actually try it but it did the trick for me. This is only valid if you fixed all framework linking issue. Which was the case for me but I was still left with few Mach-O errors.

我提供的解决方案听起来很奇怪,我花了一段时间才真正尝试它,但它对我有用。这仅在您修复了所有框架链接问题时才有效。对我来说就是这种情况,但我仍然很少有 Mach-O 错误。

What I did was to remove all libraries from the linked frameworks and libraries (in General tab iOSTarget) and then added them back by just dragging them from the left pane to the linked frameworks and library space.

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