Apple Mach-O Linker Error: duplicate symbol _y [duplicate] - iphone

duplicate symbol _y in:
/Users/archanamehta/Library/Developer/Xcode/DerivedData/GuideforCODGhosts-ftrljupdxywopwckemagyiliitss/Build/Intermediates/GuideforCODGhosts.build/Debug-iphonesimulator/GuideforCODGhosts.build/Objects-normal/i386/SecondaryWeaponsViewController.o
/Users/archanamehta/Library/Developer/Xcode/DerivedData/GuideforCODGhosts-ftrljupdxywopwckemagyiliitss/Build/Intermediates/GuideforCODGhosts.build/Debug-iphonesimulator/GuideforCODGhosts.build/Objects-normal/i386/PrimaryWeaponsViewController.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have an error in my application. Above is the error I am getting. I am not sure what to do. Please help.
Thanks
EDIT
Source code for .h file of PrimaryWeaponsViewController
http://gyazo.com/1dd400959f043bddbc59ec8d0c4f6c60
Source code for .h file SecondaryWeaponsViewController
http://gyazo.com/76b3d1fa2b766e904af41489e36cba60

The error lines provided have the name of the files where the error is:
SecondaryWeaponsViewController
PrimaryWeaponsViewController
Look at these files.
Best bet given no source code is that there is a variable _y that is declared a global. Note that #properties *auto-generate instance variables and add a leading "_"* to them.
Post the code for these methods, how they are related and the portions dealing with an variable "y"/ This could be a variable declared in a .h header file that both classes import.

Related

duplicate symbol for architecture armv7 error

I'm getting following error after including an external framework and building the project with it. Don't know what to do. Only headers file of the external framework are available to me. All the implementation files (.m) are in a .exe file so I can't access them.
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
/Users/u311107/Library/Developer/Xcode/DerivedData/ConsumerApp-awxafvfmhvwglmdvoobikahakarp/Build/Intermediates/ConsumerApp.build/Debug-iphoneos/ConsumerApp.build/Objects-normal/armv7/AppDelegate.o
/Users/u311107/Desktop/Stash/Mall/consumer/KMCSDK.framework/KMCSDK(AppDelegate.o)
duplicate symbol _OBJC_METACLASS_$_AppDelegate in:
/Users/u311107/Library/Developer/Xcode/DerivedData/ConsumerApp-awxafvfmhvwglmdvoobikahakarp/Build/Intermediates/ConsumerApp.build/Debug-iphoneos/ConsumerApp.build/Objects-normal/armv7/AppDelegate.o
/Users/u311107/Desktop/Stash/Mall/consumer/KMCSDK.framework/KMCSDK(AppDelegate.o)
ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help.
Thanks.
It seems like, KMCSDK.framework has already declared an AppDelegate class, if you can not modify the source code of KMCSDK.framework and rebuild it, you should rename AppDelegate in your project to fix this problem.

Duplicate Symbol in _main

Can someone tell me why I am getting this error. I have tried cleaning and building several times . But still I am getting this error.
duplicate symbol _main in:
/Users/outthinkingindiapvtltd/Library/Developer/Xcode/DerivedData/PatternTest- axdlojadtjwkbvdioeiumrzlovix/Build/Intermediates/PatternTest.build/Debug-iphoneos/PatternTest.build/Objects-normal/armv7/main-EC3660AC7D58737D.o
/Users/outthinkingindiapvtltd/Library/Developer/Xcode/DerivedData/PatternTest-axdlojadtjwkbvdioeiumrzlovix/Build/Intermediates/PatternTest.build/Debug-iphoneos/PatternTest.build/Objects-normal/armv7/main-6C8789F4078B135A.o
ld: 1 duplicate symbol for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This means, you have a file twice in your Xcode Project. Check the Project folder, You will find a file in two different groups or folders with the same name.
It seems you have multiple entries under Targets/Compiled Sources. removed them and the problem is solved.
It might be possible you have imported an .m file instead of .h, like:
#import "DemoView.m"
Just check the extensions of the file you recently imported, after which you are getting this error.

llvm-gcc-4.2 failed with xcode error in iphone

This may be a simple problem.
But im totally stuck with this error.
I integrated three 20 into my project.
I integrated the Sharekit also into the project and three20.
But whenever i compile the following error is showing.i can't figure this error.
Can anyone please help me this.Thanks in advace.
Error:
ld: duplicate symbol _OBJC_METACLASS_$_SHKDelicious in /Users/icodingmacmini3/Library/Developer/Xcode/DerivedData/Awesome-gqlhzchmnubhcbetpcfvbiccpdzu/Build/Products/Debug-iphoneos/libThree20UI.a(SHKDelicious.o) and /Users/icodingmacmini3/Library/Developer/Xcode/DerivedData/Awesome-gqlhzchmnubhcbetpcfvbiccpdzu/Build/Intermediates/Awesome.build/Debug-iphoneos/Awesome.build/Objects-normal/armv7/SHKDelicious.o for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
When ever you get a duplicate symbol check for imports. Some kind of cycle would have happened. Try importing in .m file rather than .h file it may solve the problem.
Also make sure you have not added the file twice.
This is a linkage error. The meaning of this error is that , you have used the symbol SHKDelicious twice. Check the links below
duplicate symbol _OBJC_METACLASS_$_ClassName
http://www.dizzey.com/development/ios/duplicate-symbols-when-linking-objectivec-static-libraries/
http://www.mac-forums.com/forums/os-x-development-darwin/171821-duplicate-symbol-_objc_metaclass_.html

Issues when installing th json framework on xcode4

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?
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
Each .m file is here only once
In the class I need JSON parsing I'll just import:
#import "JSON.h"
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

xcode collect2: ld returned 1 exit status - how to resolve?

From what I have read this is supposed to be when the linker (not exactly sure how that works) can't find a symbol. the symbol in question is: SCNetworkReachabilityCreateWithAddress as can be seen from the full error message below.
the thing is that the correct
framework is added to my target.
xcode recognises the symbol OK, i.e.
there is no error message in the .m
file.
the .m file is added to the correct
target so I'm not at all sure what to
do.
Any ideas please?
"SCNetworkReachabilityCreateWithAddress", referenced from:
-[AppWelcomeVC viewDidLoad] in AppWelcomeVC.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Do you have #import <Availability.h> in your AppWelcomeVC class header, or added to your precompiled header (MyApp_Prefix.pch)?
What frameworks do you have in your project?
In the past when I've had this error removing the framework and readding it fixed the problem.
Permissions problems with the framework file itself can also cause this error.