4

I got this error when i tried to build:

"duplicate symbol __Z8ERRCHECK11FMOD_RESULT in:

/Users/codemenmini2012-2/Library/Developer/Xcode/DerivedData/MagicSleepFullVersion-agxulkdijnxbqmbuigucmrczufyw/Build/Intermediates/MagicSleepFullVersion.build/Debug-iphonesimulator/MagicSleepFullVersion.build/Objects-normal/i386/MagicSleepViewController.o

/Users/codemenmini2012-2/Library/Developer/Xcode/DerivedData/MagicSleepFullVersion-agxulkdijnxbqmbuigucmrczufyw/Build/Intermediates/MagicSleepFullVersion.build/Debug-iphonesimulator/MagicSleepFullVersion.build/Objects-normal/i386/MagicSleepViewControllerIpad.o

ld: 1 duplicate symbol for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)"

How to solve this guys?

John
  • 163
  • 2
  • 3
  • 10
  • Are those files exist more than once in your project check that? – Exploring Feb 07 '13 at 08:32
  • Did you accidentally import a .m file? Or is there a duplication of a file in Compile Sources? – esh Feb 07 '13 at 08:46
  • In my case, there was an issue with project>Build settings>Other Linker Flags (Here same files/framework was imported twice, After removing the duplicate file/framework , working fine!! ) – Ravi Feb 22 '18 at 07:42

8 Answers8

19

The error may occur when you copy and paste the contents of one file to another file with its interface name which means two classes with same interface name.

In your code you have two different files with the same Interface name.

Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
Ravindra Bagale
  • 17,226
  • 9
  • 43
  • 70
5

For me this error happened because I was dumb enough to copy the whole folder of a downloaded lib to the project and there was a demo project inside it. So I had two main.m files. Hope this helps anyone!

Thpramos
  • 441
  • 4
  • 15
4

In my case I had accidently imported .m file instead if .h file. Hope it helps someone for this kinda silly mistake.

Azhar Bandri
  • 892
  • 1
  • 14
  • 27
  • thanks, you cure my headache.. lol that was my friend who add .m file. your answer made me search .m file in header – RamGrg Sep 17 '14 at 06:55
3

when you create bool variables with same name in two different classes then this error comes. "duplicate symbol __Z8ERRCHECK11FMOD_RESULT in" so check your both classes MagicSleepViewController.m and MagicSleepViewControllerIpad.m. for same bool variables.

Change the bool variable name, your problem will solve.

aBilal17
  • 2,974
  • 2
  • 17
  • 23
2

Looks like you have at least one (probably more) symbol (or methods, functions, etc.) that's duplicated between MagicSleepViewController.m and MagicSleepViewControllerIpad.m.

You need to either 1) change the names of one set of duplicated methods or 2) figure out a way to merge MagicSleepViewController.m & MagicSleepViewControllerIpad.m so the same code will work on both iPhones and iPads (e.g. using run time conditionals or whatever to determine what kind of device your code is currently running on).

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
0

I had #defines placed in two files that were exactly the same... DOH.

theprojectabot
  • 1,163
  • 12
  • 19
0

For me, a search in the finder for the named duplicates has helped.

Patricia
  • 2,885
  • 2
  • 26
  • 32
0

The problem in my case was caused due to multiple references in the "Compile Sources". So I deleted one from Project->Build Phases-> Compile Sources.

Raxak
  • 389
  • 3
  • 17