目标C:链接器命令失败,退出代码为1

时间:2023-01-18 16:43:00

This is the error I'm getting when I try to build my app.

这是我在尝试构建应用程序时遇到的错误。

ld: 10 duplicate symbols for architecture arm64

ld:架构arm64的10个重复符号

目标C:链接器命令失败,退出代码为1

4 个解决方案

#1


0  

From the error, I would guess that:

从错误中,我猜:

  • you have two files, VaultSelectionViewController.m and SetLockViewController.m (the first being originally a copy of the second, probably)

    你有两个文件,VaultSelectionViewController.m和SetLockViewController.m(第一个原本是第二个的副本,可能)

  • they both contain @implementation SetLockViewController, and identical properties and/or methods and/or instance variables.

    它们都包含@implementation SetLockViewController,以及相同的属性和/或方法和/或实例变量。

Solution: fix the class name in the @implementation to match the file name.

解决方案:修复@implementation中的类名以匹配文件名。

If that's not the issue, please provide the relevant parts of both files.

如果这不是问题,请提供两个文件的相关部分。

#2


0  

Your project twice referring to file SetLockViewController.m. My suggestion is take a copy of class out side of your project.

您的项目两次引用文件SetLockViewController.m。我的建议是从你的项目中取出课程副本。

[1] Then right click on SetLockViewController.m file and delete > move to trash.

[1]然后右键单击SetLockViewController.m文件并删除>移动到垃圾箱。

[2] Go to project files directory in finder. Then delete the file SetLockViewController.m (if you find any).

[2]转到finder中的项目文件目录。然后删除文件SetLockViewController.m(如果你发现任何)。

[3] Clean the build and run.

[3]清理构建并运行。

Follow same method if any other duplicate files/linker errors present.

如果存在任何其他重复文件/链接器错误,请遵循相同方法

#3


0  

目标C:链接器命令失败,退出代码为1

  1. Make sure your compile sources does not have dup files. (Bad merge can cause this issue.) Remove them and add them again can fix this build error.

    确保您的编译源没有dup文件。 (错误合并可能会导致此问题。)删除它们并再次添加它们可以修复此生成错误。

  2. Make sure you does not implement one function twice. (Copy codes and forget to rename the @implement XXX? Or copy and paste one function twice?) Just search the function define in your project and remove the dup one.

    确保没有两次实现一个功能。 (复制代码并忘记重命名@implement XXX?或者复制并粘贴一个函数两次?)只需搜索项目中的函数define并删除dup函数。

#4


0  

Please check all the variables name in every classes of your project and make sure that all they have unique name including outside the class

请检查项目的每个类中的所有变量名称,并确保它们具有唯一的名称,包括在课外

#1


0  

From the error, I would guess that:

从错误中,我猜:

  • you have two files, VaultSelectionViewController.m and SetLockViewController.m (the first being originally a copy of the second, probably)

    你有两个文件,VaultSelectionViewController.m和SetLockViewController.m(第一个原本是第二个的副本,可能)

  • they both contain @implementation SetLockViewController, and identical properties and/or methods and/or instance variables.

    它们都包含@implementation SetLockViewController,以及相同的属性和/或方法和/或实例变量。

Solution: fix the class name in the @implementation to match the file name.

解决方案:修复@implementation中的类名以匹配文件名。

If that's not the issue, please provide the relevant parts of both files.

如果这不是问题,请提供两个文件的相关部分。

#2


0  

Your project twice referring to file SetLockViewController.m. My suggestion is take a copy of class out side of your project.

您的项目两次引用文件SetLockViewController.m。我的建议是从你的项目中取出课程副本。

[1] Then right click on SetLockViewController.m file and delete > move to trash.

[1]然后右键单击SetLockViewController.m文件并删除>移动到垃圾箱。

[2] Go to project files directory in finder. Then delete the file SetLockViewController.m (if you find any).

[2]转到finder中的项目文件目录。然后删除文件SetLockViewController.m(如果你发现任何)。

[3] Clean the build and run.

[3]清理构建并运行。

Follow same method if any other duplicate files/linker errors present.

如果存在任何其他重复文件/链接器错误,请遵循相同方法

#3


0  

目标C:链接器命令失败,退出代码为1

  1. Make sure your compile sources does not have dup files. (Bad merge can cause this issue.) Remove them and add them again can fix this build error.

    确保您的编译源没有dup文件。 (错误合并可能会导致此问题。)删除它们并再次添加它们可以修复此生成错误。

  2. Make sure you does not implement one function twice. (Copy codes and forget to rename the @implement XXX? Or copy and paste one function twice?) Just search the function define in your project and remove the dup one.

    确保没有两次实现一个功能。 (复制代码并忘记重命名@implement XXX?或者复制并粘贴一个函数两次?)只需搜索项目中的函数define并删除dup函数。

#4


0  

Please check all the variables name in every classes of your project and make sure that all they have unique name including outside the class

请检查项目的每个类中的所有变量名称,并确保它们具有唯一的名称,包括在课外