1

Hello I am trying to install json framework. According to installation instructions I have to copy all the classes from json-framwork/classes in my project! I did that and I am getting this error:

ld: duplicate symbol _OBJC_METACLASS_$_SBJsonParser in /Users/user/Library/Developer/Xcode/DerivedData/testhttp-eavsbuatbfoagsgbqfnevfpjxxfc/Build/Intermediates/testhttp.build/Debug-iphonesimulator/testhttp.build/Objects-normal/i386/SBJsonParser-4254E5B76E32172.o and /Users/user/Library/Developer/Xcode/DerivedData/testhttp-eavsbuatbfoagsgbqfnevfpjxxfc/Build/Intermediates/testhttp.build/Debug-iphonesimulator/testhttp.build/Objects-normal/i386/SBJsonParser-46310C881BFA9776.o for architecture i386 collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1

What I am doing wrong here?

EmptyStack
  • 51,274
  • 23
  • 147
  • 178
user622203
  • 149
  • 6
  • 20

2 Answers2

5

Please have a look at:

iPhone: Duplicate Symbol Error?

Select the project navigator in the right sidebar. Double click your project(top element).

Now open the build phases tab. There is a section which is called Compile Sources. Open it an check if there is a duplice entry of the file which the error refers to.

My Installation of the json-framework

Just added these files to my project

enter image description here

Each .m file is here only once

enter image description here

In the class I need JSON parsing I'll just import:

#import "JSON.h"
Community
  • 1
  • 1
Nick Weaver
  • 47,228
  • 12
  • 98
  • 108
  • I have duplicates but not in the same folder. I am using fb sdk which has "json" folder and there are 5 classes with the same name. If i try to delete these classes from the original json framework I am getting other error.What are you suggest me? – user622203 May 25 '11 at 21:23
  • @It doesn't matter if you have the same class in many places, for compilation it'll only accept one unique class. What other errors are you getting? – Nick Weaver May 25 '11 at 21:24
  • @user622203 I some pictures to illustrate how I installed the framework. – Nick Weaver May 25 '11 at 21:29
  • this is the error:ld: duplicate symbol _OBJC_METACLASS_$_SBJsonParser in /Users/mixalismavris/Library/Developer/Xcode/DerivedData/testhttp-eavsbuatbfoagsgbqfnevfpjxxfc/Build/Intermediates/testhttp.build/Debug-iphonesimulator/testhttp.build/Objects-normal/i386/SBJsonParser-106FA3F38C16E67D.o and /Users/mixalismavris/Library/Developer/Xcode/DerivedData/testhttp-eavsbuatbfoagsgbqfnevfpjxxfc/Build/Intermediates/testhttp.build/Debug-iphonesimulator/testhttp.build/Objects-normal/i386/SBJsonParser-46310C881BFA9776.o for architecture i386 – user622203 May 25 '11 at 21:34
  • 1
    The issue is when I have facebook sdk and json in the same project – user622203 May 25 '11 at 21:41
  • @user622203 could it be that you already have the json framework installed with the facebook sdk you've installed? You should remove the json framework you added recently and see if you can still use it. – Nick Weaver May 25 '11 at 21:46
  • I found the compiled sources in the targets group (icon looks like a bullseye), there were duplicates in there which I removed. – Allfocus Jul 16 '11 at 06:41
  • I have nearly the same problem, but I have got 2 Subprojects which both use SBJson. So I have no duplicates in the build phases, but still the same linking issue. Any ideas? – fabb Dec 27 '11 at 15:54
  • I love you so much. Thank you. – Andrew Kozlik Jun 26 '12 at 03:57
0

I just erase the .m and .h files from JSON Framework wich the compilator was giving me errors, at the end I just keep from the JSON Framework: NSObject+SBJSON, NSSTring+SBJSON .h and m. This worked for me, I hope it helps :D

Gustavo
  • 785
  • 1
  • 12
  • 31