I gone through question already asked on forum. Getting error as below
ld: 8 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
More error description is below
ld: warning: directory not found for option '-L/Users/Documents/Sprint1/iPhone/MyApplication/MyApplication/lib/lib'
ld: warning: directory not found for option '-Lrestkit'
ld: warning: ignoring file /Users/Documents/Sprint1/iPhone/MyApplication/MyApplication/lib/lib restkit/libRestKit.a, missing required architecture i386 in file /Users/Documents/Sprint1/iPhone/MyApplication/MyApplication/lib/lib restkit/libRestKit.a (2 slices)
duplicate symbol _OBJC_IVAR_$_Reachability.reachabilityRef in:
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Intermediates/MyApplication.build/Debug-iphonesimulator/MyApplication.build/Objects-normal/i386/Reachability.o
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Products/Debug-iphonesimulator/libPOSNirvanaUtils.a(Reachability.o)
duplicate symbol _kReachabilityChangedNotification in:
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Intermediates/MyApplication.build/Debug-iphonesimulator/MyApplication.build/Objects-normal/i386/Reachability.o
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Products/Debug-iphonesimulator/libPOSNirvanaUtils.a(Reachability.o)
duplicate symbol _kInternetConnection in:
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Intermediates/MyApplication.build/Debug-iphonesimulator/MyApplication.build/Objects-normal/i386/Reachability.o
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Products/Debug-iphonesimulator/libPOSNirvanaUtils.a(Reachability.o)
duplicate symbol _kLocalWiFiConnection in:
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Intermediates/MyApplication.build/Debug-iphonesimulator/MyApplication.build/Objects-normal/i386/Reachability.o
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Products/Debug-iphonesimulator/libPOSNirvanaUtils.a(Reachability.o)
duplicate symbol _OBJC_IVAR_$_Reachability.key_ in:
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Intermediates/MyApplication.build/Debug-iphonesimulator/MyApplication.build/Objects-normal/i386/Reachability.o
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Products/Debug-iphonesimulator/libPOSNirvanaUtils.a(Reachability.o)
duplicate symbol _OBJC_CLASS_$_Reachability in:
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Intermediates/MyApplication.build/Debug-iphonesimulator/MyApplication.build/Objects-normal/i386/Reachability.o
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Products/Debug-iphonesimulator/libPOSNirvanaUtils.a(Reachability.o)
duplicate symbol _OBJC_METACLASS_$_Reachability in:
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Intermediates/MyApplication.build/Debug-iphonesimulator/MyApplication.build/Objects-normal/i386/Reachability.o
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Products/Debug-iphonesimulator/libPOSNirvanaUtils.a(Reachability.o)
duplicate symbol _kConnectionDown in:
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Intermediates/MyApplication.build/Debug-iphonesimulator/MyApplication.build/Objects-normal/i386/Reachability.o
/Users/Library/Developer/Xcode/DerivedData/MyApplication-bchgbqjzuwjzbcbnhwyihhatsoyw/Build/Products/Debug-iphonesimulator/libPOSNirvanaUtils.a(Reachability.o)
ld: 8 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have project structure like
Application
Static library A
Static library B
Situation
1) Static library A depend on static library B. The project A require Reachability check.
2) Added static library A into Application project
3) When I compile,getting linker error
Please help to resolve this issue.
If this solution is not working then check this..
Another reason this error often happens is accidentally importing the .m file instead of the .h.
Steps:
1.Check Build phases in Target settings.
2.Check if any file exists twice or once.
3.If file exist twice delete one. If not delete file in the bottom which is the latest one.
4.Build again.
You have Reachability class in libPOSNirvanaUtils.a & your Application and you are using libPOSNirvanaUtils.a in your application. So now your application has 2 reference of Reachability class.
If you are building libPOSNirvanaUtils.a then you can solve this with 2 ways:
Remove Reachability class membership from target libPOSNirvanaUtils.a
Add Reachability class in Copy files, remove Reachability class reference from your Application and use same class reference from libPOSNirvanaUtils.
I had the same problem while using prepareforsegue delegate. It turns out, I accidentally imported the .m file instead of the .h file. This will fix it. Look at your #import statements before you go crazy adding and deleting frameworks.
In my case I got this error because had the same named variables declared in several files in implementation part.
#implementation A
int a;
...
#implementation B
int a;
...
gave me "duplicate symbol _a ..."
Related
I tried to set conversion tracking in my iOS game, but I didn't be able to do that. The tutorial can be found here: https://developers.google.com/app-conversion-tracking/ios/?hl=it#usage_and_disclosure
I integrate the GoogleConversionTrackingSDK to my project, load AdSupport framework and type -ObjC in Other linker flags.
I tried to convert this snippet from Obj-C:
[ACTConversionReporter reportWithConversionID:#"MY_ID" label:#"MY_LABEL" value:#"MY_VALUE" isRepeatable:NO];
to Swift:
ACTConversionReporter.reportWithConversionID("MY_ID", label: "MY_LABEL", value: "MY_VALUE", isRepeatable: false)
and I put that in didFinishLaunchingWithOptions method of AppDelegate.swift, but I get the error:
Use of unresolved identifier 'ACTConversionReporter'
If I type in Obj-C bridging header in Swift Compiler - Code Generation in Build Settings "ACTReporter.h" (without qm), I put the header file in the folder of my game or if I type the whole path of "ACTReporter.h" ending with its name, I fail the build and I get 2 errors:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ACTConversionReporter", referenced from:
type metadata accessor for __ObjC.ACTConversionReporter in AppDelegate.o
ld: symbol(s) not found for architecture armv7 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I don't know what to do. I hope there is someone who can fix this.
You need to add to your project "YourProjectName-Bridging-Header.h" file
Here you can see how to add the file
in Bridging Header file add #import "ACTReporter.h"
Then it will work for you!
I'm using paho MQTT library in my project.
And when I build the project on simulator , I got the following errors.
duplicate symbol _client_version_eye in:
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTClient.o
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTAsync.o
duplicate symbol _Log_levels in:
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTPacket.o
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTAsync.o
duplicate symbol _Log_levels in:
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTPacket.o
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTProtocolClient.o
duplicate symbol _Log_levels in:
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTPacket.o
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/Socket.o
duplicate symbol _Log_levels in:
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTPacket.o
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTPersistence.o
duplicate symbol _Log_levels in:
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTPacket.o
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/Thread.o
duplicate symbol _Log_levels in:
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTPacket.o
/Users/xieweizhi/Library/Developer/Xcode/DerivedData/mgiosapp-bctgnqpjhalyqageaduowfwrsrkh/Build/Intermediates/mgiosapp.build/Debug-iphonesimulator/mgiosapp.build/Objects-normal/i386/MQTTProtocolOut.o
ld: 25 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
MQTTClient.c and MQTTAsync.c should not be included in the same project. They are used to build different libraries. Decide whether you want the blocking or async behaviour and use that file.
Try it....
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.
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).
Also Clean your project and build folder sometimes it will also solve this error
Also delete the derived data.
My app was working fine but after some modification I am getting following error please help me ......
duplicate symbol _OBJC_IVAR_$_MBThirdViewController.nameLabel1 in:
/Users/major/Library/Developer/Xcode/DerivedData/sideMenu- bslwsbjqbjtkojeslptbkyhajajv/Build/Intermediates/sideMenu.build/Debug- iphonesimulator/sideMenu.build/Objects-normal/i386/MBThirdViewController- D5D149C1AA17C975.o
duplicate symbol _OBJC_IVAR_$_MBThirdViewController.phoneLabel1 in:
/Users/major/Library/Developer/Xcode/DerivedData/sideMenu-bslwsbjqbjtkojeslptbkyhajajv/Build/Intermediates/sideMenu.build/Debug- iphonesimulator/sideMenu.build/Objects-normal/i386/MBThirdViewController-D5D149C1AA17C975.o
duplicate symbol _OBJC_IVAR_$_MBThirdViewController.emailLabel1 in:
/Users/major/Library/Developer/Xcode/DerivedData/sideMenu-bslwsbjqbjtkojeslptbkyhajajv/Build/Intermediates/sideMenu.build/Debug-iphonesimulator/sideMenu.build/Objects-normal/i386/MBThirdViewController-D5D149C1AA17C975.o
duplicate symbol _OBJC_IVAR_$_MBThirdViewController.photoView1 in:
/Users/major/Library/Developer/Xcode/DerivedData/sideMenu- bslwsbjqbjtkojeslptbkyhajajv/Build/Intermediates/sideMenu.build/Debug- iphonesimulator/sideMenu.build/Objects-normal/i386/MBThirdViewController- D5D149C1AA17C975.o
duplicate symbol _OBJC_IVAR_$_MBThirdViewController.imageVC in:
/Users/major/Library/Developer/Xcode/DerivedData/sideMenu- bslwsbjqbjtkojeslptbkyhajajv/Build/Intermediates/sideMenu.build/Debug- iphonesimulator/sideMenu.build/Objects-normal/i386/MBThirdViewController- D5D149C1AA17C975.o
duplicate symbol _OBJC_IVAR_$_MBThirdViewController.dataObject in:
/Users/major/Library/Developer/Xcode/DerivedData/sideMenu-bslwsbjqbjtkojeslptbkyhajajv/Build/Intermediates/sideMenu.build/Debug-iphonesimulator/sideMenu.build/Objects-normal/i386/MBThirdViewController-D5D149C1AA17C975.o
duplicate symbol _OBJC_CLASS_$_MBThirdViewController in:
/Users/major/Library/Developer/Xcode/DerivedData/sideMenu-bslwsbjqbjtkojeslptbkyhajajv/Build/Intermediates/sideMenu.build/Debug- iphonesimulator/sideMenu.build/Objects-normal/i386/MBThirdViewController- D5D149C1AA17C975.o
duplicate symbol _OBJC_METACLASS_$_MBThirdViewController in:
/Users/major/Library/Developer/Xcode/DerivedData/sideMenu- bslwsbjqbjtkojeslptbkyhajajv/Build/Intermediates/sideMenu.build/Debug- iphonesimulator/sideMenu.build/Objects-normal/i386/MBThirdViewController- D5D149C1AA17C975.o
ld: 8 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Go to Build Setting and search for No Common Blocks and set it NO. And build again you will not get this error again.
Make sure that the ViewController is not added twice in your project.
OR
you have declared same variable more than once.
Also got to Xcode->Window->Organizer->Projects
And Delete derived data
Hope that might help.
check if this MBThirdViewController is added twice in your project.
OR
remove the reference to it and try adding it again to your project.
I am facing duplicate symbols issue during use of Core plot API and ESRI map Arc GIS API.
In my app I am using Core plot and ArcGIS API. To provide support for 64 bit device, I have download new API for ArcGI (ESRI map) and accordingly update CorePlot API for 64 bit. After making changes I am facing issue:
error description are here:
duplicate symbol _squareOfDistanceBetweenPoints in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(AGSCPTUtilities.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(CPTUtilities.o)
duplicate symbol _niceNum in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(AGSCPTAxis.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(CPTAxis.o)
duplicate symbol _CreateRoundedRectPath in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(AGSCPTPathExtensions.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(CPTPathExtensions.o)
duplicate symbol _AddRoundedRectPath in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(AGSCPTPathExtensions.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(CPTPathExtensions.o)
duplicate symbol _MyCGPathApplierFunc in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(NSCoderExtensions.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(NSCoderExtensions.o)
ld: 5 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If anyone face issue please suggest. I am unable to figure out what is duplicate in those API Earlier these two working fine (OLD api without 64 bit support)
You might have imported the .m instead of the .h file
You might have added any Typedef function in .H file and have imported .H in many classes.
In my case it was an issue,
ShadowASettings ShadowSettingsMake(CGSize shadowSize, CGFloat shadowOpacity, CGFloat shadowRadius){
ShadowASettings settings;
settings.shadowOffset = shadowSize;
settings.shadowOpacity = shadowOpacity;
settings.shadowRadius = shadowRadius;
return settings;
}
I wrote this function in ABC.h
and then I imported ANC.h in my HomeVC.h and XYZ.h
So, then I simply move this function to .m of that class as it was only used in .m
Got a strange issue from Xcode, there aren't code issues and I haven't any idea how to handle with this problem. I also used Google and saw similar questions but the answers weren't useful for me.
duplicate symbol _OBJC_IVAR_$_Level._name in:
..../Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build /Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C98F33E28EFA5297.o
/Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C635B4AD47A32079.o
duplicate symbol _OBJC_IVAR_$_Level._type in:
...../Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C98F33E28EFA5297.o
...../Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C635B4AD47A32079.o
duplicate symbol _OBJC_IVAR_$_Level._binaryImage in:
...../Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C98F33E28EFA5297.o
..../Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C635B4AD47A32079.o
duplicate symbol _OBJC_CLASS_$_Level in:
..../Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C98F33E28EFA5297.o
... ../Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C635B4AD47A32079.o
duplicate symbol _OBJC_METACLASS_$_Level in:
...Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C98F33E28EFA5297.o
......Library/Developer/Xcode/DerivedData/MobileMaps-bfaaljugbcgusoazfkvdbpbdyiqf/Build/Intermediates/MobileMaps.build/Debug-iphonesimulator/MobileMaps.build/Objects-normal/i386/Level-C635B4AD47A32079.o
ld: 5 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
From what I've read there are many different reasons for this problem and therefore many different solutions but maybe someone will have done the same stupid thing as me and this will help them. I am fairly certain this is not the problem the OP experienced though as my duplicate symbols were in differently named .o files.
Basically be very careful with autocorrect when typing your #import statements. I accidentally imported the .m file instead of the proper .h file and ended up with output similar to what the OP has posted.
Hope this helps somebody!