Question

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)

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

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

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. I have tried renaming leagueTableLoaded in different classes but this doesn't fix it.

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

  3. 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

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!

Was it helpful?

Solution 2

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

OTHER TIPS

For me a duplicate symbol error came up when I absent mindedly included a .m file instead of a .h (Why does Xcode's autosuggest even show me .m files?!)

Xcode error “Duplicate Symbol” causing Apple Mach-O Linker Error is caused by duplicate symbols in Project. Steps to avoid error

  1. Go to project -> Target ->Build Phases ->Compile sources
  2. Check for the duplicate file (implementation file)
  3. Delete the file and add it again
  4. Clean and run project again

This worked for me. Hope it helps

In second view controller, you mistakenly #import "First.m", check it must be first.h file so replaces this with first.h. It's working for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top