John
John

Reputation: 163

Duplicate Symbol Error for architecture i386

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?

Upvotes: 4

Views: 18728

Answers (8)

Raxak
Raxak

Reputation: 399

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.

Upvotes: 0

Patricia
Patricia

Reputation: 2865

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

Upvotes: 0

theprojectabot
theprojectabot

Reputation: 1163

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

Upvotes: 0

Azhar Bandri
Azhar Bandri

Reputation: 892

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

Upvotes: 4

Ravindra Bagale
Ravindra Bagale

Reputation: 17655

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.

Upvotes: 19

Thpramos
Thpramos

Reputation: 441

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!

Upvotes: 5

aBilal17
aBilal17

Reputation: 3132

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.

Upvotes: 3

Michael Dautermann
Michael Dautermann

Reputation: 89509

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

Upvotes: 2

Related Questions