Mach-O Linker Error on Xcode 4.6

67,552

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

  1. Quit Xcode
  2. Restart the System
  3. Select Xcode -> Preferences -> Locations
  4. In Locations, you will see 'Derived Data'. Click on the arrow icon right next to the path.
  5. This will open a folder containing 'Derived Data', delete it.
  6. Clean the Product and Run

    if still not works then

    Build Settings > Enable Bitcode > No enter image description here

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.

Share:
67,552
Admin
Author by

Admin

Updated on January 19, 2020

Comments

  • Admin
    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
    Itai Spector almost 7 years
    Where is this button?
  • MBH
    MBH almost 7 years
    couldn't find it !? are you serious about it ?