ios 架构 arm64 的重复符号

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

Duplicate Symbols for Architecture arm64

iosobjective-cxcodelinker-errors

提问by

When I try running my Xcode Project it fails with an error stating that I have duplicate symbols. I looked online where the find these duplicates but have had no luck:

当我尝试运行我的 Xcode 项目时,它失败并显示错误,指出我有重复的符号。我在网上查找这些重复项但没有运气:

enter image description here

在此处输入图片说明

Any ideas how to fix this?

任何想法如何解决这一问题?

采纳答案by picciano

From the errors, it would appear that the FacebookSDK.framework already includes the Bolts.framework classes. Try removing the additional Bolts.framework from the project.

从错误来看,FacebookSDK.framework 似乎已经包含 Bolts.framework 类。尝试从项目中删除额外的 Bolts.framework。

回答by tania_S

For me it helped to switch the "No Common Blocks" compiler setting to NO: It pretty much seems to make sense, the setting is explained here: What is GCC_NO_COMMON_BLOCKS used for?

对我来说,它有助于将“No Common Blocks”编译器设置切换为 NO:这似乎很有意义,此处解释了该设置: GCC_NO_COMMON_BLOCKS 用于什么?

回答by Adam G

Using Xcode 8, "Update project to recommended settings" option turned ON 'No Common Blocks' for my project.

使用 Xcode 8,“将项目更新为推荐设置”选项为我的项目打开了“无公共块”。

Turning it back to OFF fixed everything up.

将其转回 OFF 修复了一切。

回答by Jason Silver

For me it was that i imported a file as a .m not a .h by mistake

对我来说,我错误地将文件导入为 .m 而不是 .h

回答by Matea

I've messed up my pods while downgrading a pod and I've managed to resolve the issue with duplicate symbols for architecture arm64by removing the pods and installing them again with:

我在降级 pod 时弄乱了我的 pod,并且通过删除 pod 并再次安装它们,我设法解决了架构 arm64 重复符号的问题:

pod deintegrate
pod install

回答by Matea

Another Solution is to:

另一个解决方案是:

Select Project-> Target-> Build phase-> Compile source-> search for the file which is mentioned in the 3rd last error line (In your case BFAppLinkReturnToRefererView.o).

选择Project-> Target-> Build phase-> Compile source-> 搜索最后一个错误行中提到的文件(在您的情况下为BFAppLinkReturnToRefererView.o)。

Then you will see either 1 or 2 files in search result.

然后您将在搜索结果中看到 1 或 2 个文件。

Removeone of them and compile again. It should recompile now because there is only one file left and no more conflicts for build.

删除其中之一并再次编译。它现在应该重新编译,因为只剩下一个文件并且没有更多的构建冲突。

If that doesnt work the file probably has errors in it and you should remove all of them and then recompile. It should work again.

如果这不起作用,文件中可能有错误,您应该删除所有错误,然后重新编译。它应该再次工作。

回答by iosCurator

On upgrading to Xcode 8, I got a message to upgrade to recommended settings. I accepted and everything was updated. I started getting compile time issue :

在升级到 Xcode 8 时,我收到一条消息,要求升级到推荐设置。我接受了,一切都更新了。我开始遇到编译时问题:

Duplicate symbol for XXXX Duplicate symbol for XXXX Duplicate symbol for XXXX

XXXX 的重复符号 XXXX 的重复符号 XXXX 的重复符号

A total of 143 errors. Went to Target->Build settings -> No Common Blocks -> Set it to NO. This resolved the issue. The issue was that the integrated projects had code blocks in common and hence was not able to compile it. Explanation can be found here.

一共143个错误。转到目标-> 构建设置-> 无公共块-> 将其设置为否。这解决了问题。问题是集成项目有共同的代码块,因此无法编译它。可以在此处找到说明。

回答by Dan Loughney

If you are moving to Xcode 7 or 8 and are opening a really old project, I've encountered this problem:

如果您正在使用 Xcode 7 或 8 并且正在打开一个非常旧的项目,我会遇到这个问题:

in SomeConstFile.h

SomeConstFile.h

NSString * const kAConstant;

in SomeConstFile.m

SomeConstFile.m

NSString *const kAConstant = @"a constant";

Earlier versions of the compiler assumed that the definition in the header file was extern and so including SomeConstFile.h all over the place was fine.

早期版本的编译器假定头文件中的定义是 extern,因此在所有地方都包含 SomeConstFile.h 就可以了。

Now you need to explicitly declare these consts as extern:

现在您需要将这些常量显式声明为 extern:

in SomeConstFile.h

SomeConstFile.h

extern NSString * const kAConstant;

回答by Saumil Shah

Below Patch work for me..:)

下面的补丁为我工作..:)

Step 1: Go to TARGETS -> Build Settings -> No Common Blocks -> No

Step 2: Go to TARGETS -> Build Settings -> enable testability -> No

Setting it back to NO solved the problem!

将其设置回 NO 解决了问题!

回答by ManyuBishnoi

This error happens when Linker is trying to link the obj files. Few reasons that i could think of for this error are:

当链接器尝试链接 obj 文件时会发生此错误。我能想到的这个错误的几个原因是:

  1. The duplicated Function/Class is defined at two different places/files in the project and only one of them was supposed to compile for any variation of build command. But somehow both those files got compiled in your project. So you need to check your if-else conditions or other dependencies which adds src files to the list of files needed to be compiled and remove the un-needed file for your particular build command.

  2. The duplicated Function/Class is defined accidentally at two different places/files in the project. Remove the wrong definition.

  3. Clean your OBJ directory before you build again, there could be some old obj files in there from your previous builds which might be causing this conflict.

  1. 重复的函数/类在项目中的两个不同位置/文件中定义,并且只有其中一个应该针对构建命令的任何变体进行编译。但不知何故,这两个文件都在您的项目中编译。因此,您需要检查 if-else 条件或其他依赖项,这些依赖项将 src 文件添加到需要编译的文件列表中,并删除特定构建命令不需要的文件。

  2. 重复的函数/类是在项目中的两个不同位置/文件中意外定义的。删除错误的定义。

  3. 在再次构建之前清理您的 OBJ 目录,其中可能有一些来自您之前构建的旧 obj 文件,这可能会导致此冲突。

P.S i am no expert, but this is how i solved this problem when i faced it. :)

PS我不是专家,但这就是我遇到这个问题时解决这个问题的方法。:)