duplicate symbol for architecture armv7 error - iphone

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.

Related

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

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.

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.

Correct way to use a private library in objective c?

I downloaded a collection of private libraries from this link. When I click download I get all frameworks. So these are only header files not the .framework files that are available in Xcode. So I linked them by the usual method of going to build phases, in it I go to link binary with libraries click on + and choose the header files from a framework (preferences framework in my case). After these files are added to my project I try to make an object from one of the libraries and try to call their instance methods. When I try to execute this program I get this error. I get this whether I run it on the device or simulator.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_DevicePINController", referenced from:
objc-class-ref in UAViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1
(use -v to see invocation)
DevicePinController is a part of a private framework preferences.h.I am trying to make an object of it UA
EDIT: I tried using other framework headers such as bluetooth and I get this error in all.
EDIT: I tried adding the entire framework to the project instead of adding individual header files.Now the error is
d: framework not found BluetoothManager
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You'll need to actually build the framework. You can't just link against a header file; that doesn't make sense.
Try adding all the .m files in the Preferences folder as Compile Sources, and remove the header file from Link Binary with Libraries.
Added: I realize now this answer is incorrect. The files OP is trying to use are not a library, but header files from Apple's private frameworks. Here's a related answer: https://stackoverflow.com/a/13388225/893113

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

Undefined symbols for architecture armv7? What does this error mean?

I just marked all of my CocoaAsyncSocket code as non-ARC code, and it's given me these 3 errors:
Undefined symbols for architecture armv7:
"_kCFStreamNetworkServiceTypeVoIP", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamNetworkServiceType", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamPropertySSLSettings", referenced from:
-[GCDAsyncSocket maybeStartTLS] in GCDAsyncSocket.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anybody know what this means and how to fix it?
I think I found the solution to this, by looking in the code comments, but I now see that it's also what Mark Adams suggested above. I had the errors until I added the CFNetwork.framework under Targets->Build Phases->Link Binary With Libraries->Select CFNetwork.framework
It means that some code you are compiling is referencing the constants "kCFStreamNetworkServiceTypeVoIP", "kCFStreamNetworkServiceType", and "kCFStreamPropertySSLSettings", but that those constants weren't found when it tried to link your code with the libraries it uses.
Unfortunately there's a bunch of reasons this could be:
You could have misspelled them
They could be #ifdef'd out for that architecture
You might not be linking the correct librar(y, ies)
They could be marked as having 'hidden' visibility so that they can only be used in the declaring library
Probably other reasons
You can use 'nm' to poke at the exported symbols from the binary of a library, and 'otool -L' to check which libraries your binary is linking.
I had this same error when integrating LineaPro API into an app.
The fix i implemented was adding ExternalAccessory.framework to General -> Linked Framework and Libraries.
I already had CFNetwork.framework included.