Mach-O Linker Error on Xcode 4.6
Solution 1
Just go to "Build Phases" -> "Compile Sources" and look for duplicate of classes.
Solution 2
Check if you have "*.m" files in your #import
! It appears that was my mistake...
Solution 3
- Quit Xcode
- Restart the System
- Select Xcode -> Preferences -> Locations
- In Locations, you will see 'Derived Data'. Click on the arrow icon right next to the path.
- This will open a folder containing 'Derived Data', delete it.
-
Clean the Product and Run
if still not works then
Solution 4
In my example, I declared
extern NSString const *keyString
in two different files. I renamed one of them and it solved my problem.
Solution 5
In my case it was constants.
NSString *const cellID = @"cellID";
This line was written in two .m files. After appending static
keyword at the start the problem was resolved.
This issue can be recreated in a new project too. You would think that defining constants in the different .m files won't have any effect as they are private. But I don't know how the compiler is handling stuffs behind the scene. On top of that when you tap the issue from issue navigator it doesn't open up a page in the editor like it does for any other issue. Really frustrating.
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on January 19, 2020Comments
-
Admin over 4 years
I have an iOS app on Xcode 4.6 and when I recently tried to build and run in the iPhone 6.1 simulator I got a "Mach-O Linker Error." It continued to say:
ld: 17 duplicate symbols for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anyone know how to solve this?
Thanks so much!
-
Itai Spector almost 7 yearsWhere is this button?
-
MBH almost 7 yearscouldn't find it !? are you serious about it ?