ld: 2 duplicate symbols for architecture x86_64 - ios8

I am a beginner in iOS development. I am developing an application in Xcode 6.4 and I want create a SQlite database in Project. When I am trying to add constant, connection manager and query helper classes in bundle file and build project, I have the following error:
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thanks to all comment on my question,
I found the solution of ld: 2 duplicate symbols for architecture x86_64, at time of declaration of constant for table name variable, I have used NSObject class file for constant declaration,However this is not correct way to declare constant variable so I used "Header File" and declared constant variable as like below ,
#define registration_table #"registration_table"
UPDATED
If we import .m file instead of .h file that time also we facing duplicate symbols for architecture x86_64 exception, check import file .
Hope so it will help to someone

duplicate symbols 'NotificationTable' in both files, in my case ,just rename one of them and it works!

Related

Xcode build failure due to Undefined symbol: __swift_FORCE_LOAD_$_swiftFileProvider

Building failed with Xcode 13beta for React Native 0.64.2 project. It is on macOS Big Sur. The detail of error is:
Undefined symbols for architecture x86_64:
"__swift_FORCE_LOAD_$_swiftFileProvider", referenced from:
__swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What configuration change is needed to eliminate the error?
Create an empty swift file (####.swift) from Xcode in the main project which located Appdelegate.h file. This worked for my React Native project after Xcode version 13 update.
Try creating a new Swift empty file (it's not necessary to create a Bridging Header).
Adding libswiftWebKit.tbd into Link Binary With Libraries build phase in XCode helped to solve the problem:
enter image description here

Duplicate symbols for architecture armv7 : soomla issue

I got this error after reimporting the soomla package.
How to solve this?
duplicate symbol _NewBase64Encode_soomla in:
/Users/Nikunj/Unity/2D/NoOneCanDoIt/Build/b2/Libraries/Plugins/iOS/Soomla/libSoomlaiOSCore.a(NSData-Base64.o)
/Users/Nikunj/Unity/2D/NoOneCanDoIt/Build/b2/Libraries/Plugins/iOS/SoomlaShared/libKeeva.a(NSData-Base64.o)
duplicate symbol _NewBase64Decode_soomla in:
/Users/Nikunj/Unity/2D/NoOneCanDoIt/Build/b2/Libraries/Plugins/iOS/Soomla/libSoomlaiOSCore.a(NSData-Base64.o)
/Users/Nikunj/Unity/2D/NoOneCanDoIt/Build/b2/Libraries/Plugins/iOS/SoomlaShared/libKeeva.a(NSData-Base64.o)
duplicate symbol _OBJC_CLASS_$_FBEncryptorAES in:
/Users/Nikunj/Unity/2D/NoOneCanDoIt/Build/b2/Libraries/Plugins/iOS/Soomla/libSoomlaiOSCore.a(FBEncryptorAES.o)
/Users/Nikunj/Unity/2D/NoOneCanDoIt/Build/b2/Libraries/Plugins/iOS/SoomlaShared/libKeeva.a(FBEncryptorAES.o)
duplicate symbol _OBJC_METACLASS_$_FBEncryptorAES in:
/Users/Nikunj/Unity/2D/NoOneCanDoIt/Build/b2/Libraries/Plugins/iOS/Soomla/libSoomlaiOSCore.a(FBEncryptorAES.o)
/Users/Nikunj/Unity/2D/NoOneCanDoIt/Build/b2/Libraries/Plugins/iOS/SoomlaShared/libKeeva.a(FBEncryptorAES.o)
ld: 4 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 warnings only
Unfortunately libKeeva and libSoomlaiOSCore contain the same functions and classes (symbols). You need to exclude one of these libraries or rebuilt one of them not using conflicting symbols (or make it depend on another library).
Another variant is to include one of the libraries to your project as source code.
UPD: it seems like libSoomlaiOSCore and libKeeva is simply two versions of Soomla, so you can just delete one of them.

What does this mean: Undefined symbols for architecture x86_64 "_main"

I keep getting errors upon building my application on Xcode:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
None of my code is erroring and the errors are weird errors and anything I do does not resolve it. I don't think the code is relevant to the issues because it isn't referenced in the error.
This is a screenshot of the error.
The linker has not been able to find any file in the linking process with the main swift entry point. This can be due to the file not existing at all in your project, or that it exists but has not been included in the compile or link build phases.
In Swift, the main swift entry point is defined in a main.swift module, or (for iOS) in the AppDelegate.swift file there needs to be a #UIApplicationMain declaration. I don't see a Compile main.swift in your log, perhaps its missing or not included in the build phases?
Just in case, check if your AppDelegate app target is selected on the File Inspector.
( Select AppDeletage > Show the Utility > Show the file Inspector > under Target Membership, select your target.)
It happened to me after renaming an existing file.
Some time remove the reference of AppDelegate.swift from the project and add AppDelegate.swift again in project will work.

getting linker error even after linking the core data.framework to my project target file

I have linked the target file of my project to the coredata.framework in the Build Phases.
But still I am getting 3 linker errors like below:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CoreDataTableViewController", referenced from:
_OBJC_CLASS_$_RolesTableViewController in RolesTableViewController.o
"_OBJC_METACLASS_$_CoreDataTableViewController", referenced from:
_OBJC_METACLASS_$_RolesTableViewController in RolesTableViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am getting this problem in 2 coredata examples i was following from the tutorials. I tried to find if i missed a step. I think I am doing some small fundamental error...
Please help, what it could be...
I'm sure this is solved now, but I had the same problem. When you copy the files to your project you need to ensure you put a check next to your project under "Add to targets".

Code doesn't compile in unit tests target (XCode)

I have a problem with my unit tests in XCode. I have an active target which directly depends on a UnitTests target. I have generated some code with ProtocolBuffers library and I have added these classes together with ProtocolBuffers project to my project. Everything compiles well in the active target, however in the UnitTests target I'm getting the following error:
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_CRequestMessage", referenced from:
objc-class-ref in CConnection.o
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
I had noticed that the generated m file is not added to the UnitTests target so I added this file to the target. Now I'm getting over a thousand errors, including:
(...) ../ProtoBuff/Classes/CodedInputStream.h:27: error: cannot find interface declaration for 'NSObject', superclass of 'PBCodedInputStream'
NSObject is not visible?
Of course before adding the generated code everything had worked and compiled well.
Any ideas how to deal with this?
Thanks!
Did you add "ProtocolBuffers.h" to your target?

Resources