ios Xcode 出现 Apple Mach-O 链接器错误

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

Xcode gives Apple Mach-O linker error

iosobjective-clinker-errorsmach-oundefined-symbol

提问by kuranes

I just compiled a project and Xcode returns these two errors which don't seem to be my code's fault. How do I fix them?

我刚刚编译了一个项目,Xcode 返回了这两个错误,这似乎不是我的代码的错。我该如何修复它们?

Undefined symbols for architecture i386:
  "_vImageBoxConvolve_ARGB8888", referenced from:
      -[UIImage(Blur) boxblurImageWithBlur:] in UIImage+Blur.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

回答by Khaled Barazi

Teaching a man (or women) how to fish:

教男人(或女人)钓鱼:

Usually Mach-O Linker Error means you have not included a header file for a function you are using in your code.

通常 Mach-O 链接器错误意味着您没有在代码中包含您正在使用的函数的头文件。

Easiest way is to copy that function or method call and paste into Xcode quick search using shift+command+O. This will search all frameworks (and header files), find that function or method call and show you its location (the header in this case):

最简单的方法是使用 shift+command+O 复制该函数或方法调用并粘贴到 Xcode 快速搜索中。这将搜索所有框架(和头文件),找到该函数或方法调用并显示其位置(在本例中为头文件):

In this case, this call belongs to the Accelerate framework so on top of your file, enter:

在这种情况下,此调用属于 Accelerate 框架,因此在您的文件顶部,输入:

#import <Accelerate/Accelerate.h>

When doing quick search, you might have to get rid of leading underscore. In other words, search for vImageBoxConvolve_ARGB8888

在进行快速搜索时,您可能需要去掉前导下划线。换句话说,搜索 vImageBoxConvolve_ARGB8888

Hope this helps

希望这可以帮助

回答by Xono

Google is your friend: someone else fixed this by adding the Accelerate framework to their project (and this does look like a framework error).

Google 是你的朋友:其他人通过将 Accelerate 框架添加到他们的项目中来解决这个问题(这看起来确实是一个框架错误)。

https://github.com/rnystrom/RNBlurModalView/issues/5

https://github.com/rnystrom/RNBlurModalView/issues/5

Make sure you also have the QuartzCore framework included as well, as that is also required by that library.

确保您还包含 QuartzCore 框架,因为该库也需要。

回答by Rajan Twanabashu

Apparently vImageBoxConvolve_ARGB8888() is not defined. See if the Accelerate framework is properly included in the project.

显然 vImageBoxConvolve_ARGB8888() 没有定义。查看 Accelerate 框架是否正确包含在项目中。