Mike
Mike

Reputation: 477

Build failing? Apple Mach-o linker error?

My app was working fine until I started playing with archiving. Im not getting any compiler warnings or errors, but when I run the app, the build fails, saying

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

I commented out all the archiving code I was playing with, but the build continues to fail, and I have no idea why. Again theres no warning/errors until I build, so I don't know what happened or where its coming from?

Can anyone tell me what this means and what I need to do to fix it?

EDIT:

Here is what the issue navigator says:

/Users/MikeGordon/Library/Developer/Xcode/DerivedData/HW1ARC-egqtecfuosawiadlwgfulhqjdhtr/Build/Intermediates/HW1ARC.build/Debug-iphonesimulator/HW1ARC.build/Objects-normal/i386/Assignment.o ld: 18 duplicate symbols for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: 18 duplicate symbols for architecture i386

EDIT: Here are some screen shots

https://i.sstatic.net/nw2CZ.jpg

https://i.sstatic.net/c53Mm.jpg

http://imgur.com/Ena17FF

Upvotes: 1

Views: 1739

Answers (2)

Plexander
Plexander

Reputation: 61

I don't know how, but many of my .m/.h files were duplicated and under other folders. To remedy the problem, I deleted one copy of the file from one of the folders. The other duplicate file, then turned red. So, then I deleted the second copy of the file. At that point, I had no instances of either file in xCode. Then I went to my Trash, sorted by Date Added, highlighted the files that were just placed in Trash, right clicked and selected Put Back. The I went to File> Add Files to ("myProject") and selected the files I just restored. Everything was back to normal at that point. I ran the simulator and it all worked great!

Peculiarly, the Trash only had one instance of the file, even though it was referenced twice in the Project Navigator.

Upvotes: 0

Francesco Puglisi
Francesco Puglisi

Reputation: 2177

Check that there are no duplicates under Targets/Compiled sources. If there are duplicates, delete them.

Upvotes: 0

Related Questions