Ali Maisam
Ali Maisam

Reputation: 239

6 duplicate symbols for architecture i386

duplicate symbol _OBJC_METACLASS_$_SBJsonParser in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonParser.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonParser.o)
duplicate symbol _OBJC_CLASS_$_SBJsonParser in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonParser.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonParser.o)
duplicate symbol _OBJC_IVAR_$_SBJsonWriter.sortKeys in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_IVAR_$_SBJsonWriter.humanReadable in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_METACLASS_$_SBJsonWriter in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_CLASS_$_SBJsonWriter in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please tell me how to fix this issue?

Upvotes: 10

Views: 27264

Answers (9)

Narasimha Nallamsetty
Narasimha Nallamsetty

Reputation: 1263

If above all don't solve your issue, check whether you declare a constant in two different files(I mean check if you have two same(.h &.m) files. Duplicate files should not be there in your project.

Upvotes: 0

zapoo
zapoo

Reputation: 1589

if you import any of your .h file twice it happens.

For example If you import any .h file both ....ViewController.h and ....ViewController.m file it happens.

Upvotes: 0

Piyush
Piyush

Reputation: 1224

I had resolved issues please follow step.

  1. Goto application's target
  2. Compile Sources
  3. Remove duplicate file using (-).enter image description here

Upvotes: 10

Ivan Vavilov
Ivan Vavilov

Reputation: 1649

You also can:

  1. Copy .h files of conflict pods.
  2. Delete these conflict pods from podfile.
  3. Copy these .h files to project.
  4. Rename at #import </.h> to ".h" of copied .h files.
  5. Make pod install and bulid.

The trick is your code have no error because .h files imported, but .o files link correctly.

Upvotes: 0

joacar
joacar

Reputation: 961

The problem is most likely due to a typo when including the header. Check so that the header file (.h) is included and not the implementation file (.m).

This was the issue for me

Upvotes: 10

Trevor Assaf
Trevor Assaf

Reputation: 91

Something that often helps if nothing else works is to open your .pbxcodeproj file with a text editor and grep for the name of the class that is coming up in the failure log in Xcode. There might be two duplicate lines - delete one of them.

Upvotes: 7

Nikolai Ruhe
Nikolai Ruhe

Reputation: 81858

As you can see the linker complains that SBJsonWriter and SBJsonParser are both defined in libfacebook_ios_sdk.a and as individual files in your project.

You cannot really solve the problem except removing the individual files from your target.

The problem is that the developers of libfacebook_ios_sdk.a thought it would be a good idea to use the json framework (not caring for clashes with code used in the host app). This is a common problem with SDKs on iOS.

Upvotes: 21

rohan-patel
rohan-patel

Reputation: 5782

It seems you probably have some .h/.m file included twice like included some third party API/library twice, or you created some new file whose name is exactly same as already available file in project. Check out if you have any files which is duplicate in your project folder.

Upvotes: 0

Kunal
Kunal

Reputation: 649

You must have added SBJsonParser.h/.m twice in the project.

Upvotes: 2

Related Questions