Xcode错误“重复符号"导致Apple Mach-O链接器错误 [英] Xcode error "Duplicate Symbol" causing Apple Mach-O Linker Error

查看:129
本文介绍了Xcode错误“重复符号"导致Apple Mach-O链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

duplicate symbol _leagueTableLoaded in:
/Users/Brendan/Library/Developer/Xcode/DerivedData/2013-dbhrwzgxgwhfbqatgqpfrmqyucyu/Build/Intermediates/2013.build/Debug-iphonesimulator/2013.build/Objects-normal/i386/LTGlobalResultsViewController.o

/Users/Brendan/Library/Developer/Xcode/DerivedData/2013-dbhrwzgxgwhfbqatgqpfrmqyucyu/Build/Intermediates/2013.build/Debug-iphonesimulator/2013.build/Objects-normal/i386/LTJumpToMeViewController.o

duplicate symbol _showGLobalCompany in:

/Users/Brendan/Library/Developer/Xcode/DerivedData/2013-dbhrwzgxgwhfbqatgqpfrmqyucyu/Build/Intermediates/2013.build/Debug-iphonesimulator/2013.build/Objects-normal/i386/LTGlobalResultsViewController.o

/Users/Brendan/Library/Developer/Xcode/DerivedData/2013-dbhrwzgxgwhfbqatgqpfrmqyucyu/Build/Intermediates/2013.build/Debug-iphonesimulator/2013.build/Objects-normal/i386/LTJumpToPositionViewController.o

duplicate symbol _leagueTableLoaded in:

/Users/Brendan/Library/Developer/Xcode/DerivedData/2013-dbhrwzgxgwhfbqatgqpfrmqyucyu/Build/Intermediates/2013.build/Debug-iphonesimulator/2013.build/Objects-normal/i386/LTGlobalResultsViewController.o

/Users/Brendan/Library/Developer/Xcode/DerivedData/2013-dbhrwzgxgwhfbqatgqpfrmqyucyu/Build/Intermediates/2013.build/Debug-iphonesimulator/2013.build/Objects-normal/i386/LTJumpToPositionViewController.o

ld: 3 duplicate symbols for architecture i386

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

仅当我尝试在模拟器中构建时(在任何可以无错误构建的iOS设备上),我都在xcode中收到上述错误.我有三节课:

I am getting the error above in xcode only when I try to build in simulator (on any iOS device I can build without error). I have three classes:

1.LTGlobalResultsViewController 2.LTJumpToMeViewController 3.LTJumpToPositionViewController

1.LTGlobalResultsViewController 2.LTJumpToMeViewController 3.LTJumpToPositionViewController

所有三个都是在xcode中创建的,但两个都为& 3个已经在xcode之外进行了修改,然后重新构建.

All three were created in xcode but both 2 & 3 have been modified outside of xcode and then rebuilt.

在所有三个标头中定义了@property bool LeagueTableLoaded.它声明为:

The @property bool leagueTableLoaded is defined in the header for all three. it is declared as:

@property bool leagueTableLoaded;

到底是什么导致了此错误?我尝试了以下方法:

What is it exactly that is causing this error? I have tried the following:

  1. 我尝试在不同的类中重命名LeagueTableLoaded,但这不能解决问题.

  1. I have tried renaming leagueTableLoaded in different classes but this doesn't fix it.

我尝试手动删除library/developer/xcode文件夹中的派生数据"文件.

I have tried deleting my Derived Data files manually in library/developer/xcode folder.

根据其他问题,我检查了是否要导入.m文件.不是这种情况. Apple Mach-O链接器错误(重复符号")

According to other questions I have checked if I am importing a .m file. This is not the case. Apple Mach-O Linker error ("duplicate symbol")

还有其他建议吗? 谢谢, 詹姆斯

Any other suggestions or advice? Thanks, James

添加:根据要求,请找到我的.h和.m文件中的所有摘录,这些摘录引用了LeagueTableLoaded或为解决此错误而创建的任何变体:

ADDITION: As requested please find all the extracts from my .h and .m files that reference leagueTableLoaded or any of the variants I created when trying to get round this error:

LTJumpToMeViewController.h
@property bool leagueTableLoadedMe;

LTJumpToMeViewController.m
@implementation LTJumpToMeViewController
bool leagueTableLoaded = false;

LTGlobalResultsViewController.h
@property bool globalLeagueTableLoaded;

LTGlobalResultsViewController.m
@implementation LTGlobalResultsViewController
bool leagueTableLoaded = false;

LTJumpToPositionViewController.h
@property bool leagueTableLoadedPos;

LTJumpToPositionViewController.m
@implementation LTJumpToPositionViewController
bool leagueTableLoaded = false;

如有需要,我可以提供更多信息!

I can provide more information if required!

推荐答案

为此,这是由于在LTGlobalResultsViewController.m和LTJumpToPositionViewController.m中都定义了LeagueTableLoaded布尔值引起的.

In this end this was being caused by the leagueTableLoaded bool being defined in both LTGlobalResultsViewController.m and LTJumpToPositionViewController.m.

将其从其中之一中移除可解决此问题.虽然我不确定为什么它首先出现在这里!希望这对遇到相同问题的其他人有所帮助!詹姆斯

Removing it from one of them fixed the issue. Although I'm not sure why it was there in the first place! Hope this helps anyone else who experiences the same issue! James

这篇关于Xcode错误“重复符号"导致Apple Mach-O链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆