I now have the same question with above title but have not found the right answer yet. I got the error:
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o)
duplicate symbol _OBJC_METACLASS_$_MoboSDK in:
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o)
ld: 75 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help is appreciated.
Finally I find out the reason of this error cause I added -ObjC
to the Other Linker Flags
. After remove this value then I can build my project successfully, but I don't know why. Can anyone explain this?
This question is related to
ios
objective-c
xcode5
None of the above mentioned answer helped, as i had similar errors in pods and locally stored framework that looked like this,
duplicate symbol '_OBJC_METACLASS_$_EZAudioDevice' in:
/Users/(yourUserName)/Desktop/Source Code/(yourProjectName)/Pods/AudioKit/iOS/AudioKit.framework/AudioKit(EZAudioDevice.o)
/Users/(yourUserName)/Desktop/Source Code/(yourProjectName)/ChirpSDK.framework/ChirpSDK(EZAudioDevice.o)
So the fix was to locate /Users/(yourUserName)/Desktop/Source Code/(yourProjectName)/Pods
directory in project where you will find these two files namely,
In both of these files, you need to remove -ObjC
flag under OTHER_LDFLAGS = $(inherited)
, the rational for removing this is as same as already mention here
Another silly mistake that will cause this error is repeated files. I accidentally copied some files twice. First I went to Targets -> Build Phases -> Compile sources. There I noticed some files on that list twice and their locations.
Recently had a headache looking for source of an error. I was wondered, when i found out that my app doesn't want to compile, simply because i had following code snippet in different classes:
dispatch_time_t getDispatchTimeByDate(NSDate *date)
{
NSTimeInterval interval;
double second, subsecond;
struct timespec time;
dispatch_time_t milestone;
interval = [date timeIntervalSince1970];
subsecond = modf(interval, &second);
time.tv_sec = second;
time.tv_nsec = subsecond * NSEC_PER_SEC;
milestone = dispatch_walltime(&time, 0);
return milestone;
}
Hope that might help someone.
I experienced this issue after installing Cocoapods. Now happens everytime I update some pods. Solution I've found:
Go to terminal:
1) pod deintegrate
2) pod install
Also, check the item "Always Embed Swift Libraries" in your Build Settings. It should be "faded" indicating it is using the default configuration. If its set to a manual YES, hit delete over it to revert it to the default configuration. This stopped the behavior.
Remove -all_load from Other Linker Flags. It works on my project
Today , I got the same error . The error's key word is duplicate
. I fix it by:
1. Remove the duplicate file at Build Phases-->Compile Sources
2. If you can not remove it at Build Phases, you need find the file at your project and remove the reference by DELETE :
3. Add the file to your project again
4. Add the file's .m to your Build Phases-->Compile Sources again
5. Build your project, the error will disappear
If you have some common functions defined in a header file, change them into inline
.
The answers above didn't work for me. Here's how I got around it:
1) in finder, delete the entire Pods folder and Podfile.lock file 2) close the xcode project 3) run pod install in the terminal 4) open the xcode project, run the clean build command
Worked for me after that.
It worked for me
1.Go to Build Phases
2.Search for the file name
3.Delete duplicate
-> Error will go away.
If it doesn't, try to search for "file.m", if you see any #import "file.m" , clear this line
just uninstall the pod which it is related to and reinstall them.
I also have this fault today.That's because I defined a const value in a .m
file.But I defined another .m
file that also included this const value.That's means it has two same const values.So this error appears.
And my solution is adding a keyword "static
" before the const value.such as:
static CGFloat const btnConunt = 9;
And then I build the project it won't report this error.
Please check with the pod and Libraries you added. There should be one or more libraries are repeated. Please remove it from one side. I will fix the issue. And the effected library will listed in x-code error message detail.
This occurred on me when I accepted "recommended settings" pop-up on a project that I develop two years ago in Objective-C.
The problem was that when you accepted the "recommended settings" update, Xcode automatically changed or added some build settings, including GCC_NO_COMMON_BLOCKS = YES;
.
This made the build failed with the duplicate symbol
error in my updated project. So I changed No Common Block
to NO
in my build settings and the error was gone.
If you're using and think it might be your pods, try this:
pod deintegrate
pod install
Stupid one, but make sure you haven't #import
ed a .m
file by mistake somewhere
In my case, I just created a header file to define constant strings like this:
NSString *const AppDescriptionString = @"Healthy is the best way to keep fit";
I solved this scenario by using static
:
static NSString *const AppDescriptionString = @"Healthy is the best way to keep fit";
I face the same error what i did
1.Copy the duplicate symbol file (class name or framework name) from the end which is just showed above of the line (duplicate symbols for architecture x86_64).
2. Paste it in Find Navigator and press enter
It showed me duplicate class. I remove the duplicate class and run successfully.
This answer explains well as to why this problem occurs:
Xcode C++ :: Duplicate Symbols for Architecture x86_64
In my opinion you do not need to turn any of the flags off or change Xcode settings, re-read your code, and fix the problem. Changing the settings would just subside the inflammation not the cause.
Remove -ObjC from Other Linker Flags or Please check you imported any .m file instead of .h by mistake.
Following steps solved the issue for me.
For me during the Xcode8 recommended project settings update "No Common Blocks" to YES which causes this issue.
In Xcode 6.3.2. I have checked all possibility like as belowed
1: I have not import .m file in my project.
2: Removed -ObjC
from Other linker flag.
3: Removed all my derive Data.
still i am getting same error. I have removed this error by removing any variable declaration from .pch
file. in my case, i have declared AppDelegate
object in .pch
file. finally i found reason that cause error. so i remove declaration of any variable from .pch file and my project working charm.
In my case I had two main()
methods defined in my project and removing one solved the issue.
None of above solutions works for me, I just fixed it myself.
I got duplicate symbol of my core data model
which I make it myself, but
in my .xcdatamodeld
inspector, I choose Class Definition
of Codegen
property, I guess that's what's wrong with. Then I choose Manual/None
,it got fixed.
Hope this can be helpful for you!
I simply just unistalled all my pods and reinstalled them. I also got rid of some pods i did not use.
Because I haven't seen this answer:
Uninstall and reinstall your podfiles! Remove or uninstall library previously added : cocoapods
I've run into this issue over 3 times building my app and every time this is what fixes it. :)
I got the same error when I added a pod repository
pod 'SWRevealViewController'
for an already added source code (SWRevealViewController) from gitHub. So, the error will be fixed by either removing the source code or pod repository.
Case # 2:
The 2nd time, this error appeared when I declare a constant in .h file.
NSString * const SomeConstant = @"SomeValue";
@interface AppDelegate : UIResponder <UIApplicationDelegate> {
...
...
I hope it will definitely help you
I got same error 3 duplicate symbols for architecture x86_64
in my case I have copied code from another file of same project eg. code of A.m file to B.m and after complilation i got an error as mention. and i have solve error by changing the name of global Variable.
this error came in my case because of same declare for global variable in both file.
My situation with some legacy project opened in Xcode 7.3 was:
duplicate symbol _SomeEnumState in:
followed with list of two unrelated files.o, then this was repeated couple of times, then finally:
ld: 8 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What solved it for me was changing enum declaration from:
enum SomeEnumState {
SomeEnumStateActive = 0,
SomeEnumStateUsed = 1,
SomeEnumStateHidden = 2
} SomeEnumState;
to this:
typedef NS_ENUM(NSUInteger, SomeEnumState) {
SomeEnumStateActive = 0,
SomeEnumStateUsed = 1,
SomeEnumStateHidden = 2
};
If somebody has explanation for this, please enlighten me.
I have same problem. In Xcode 7.2 in path Project Target > Build Setting > No Common Blocks, i change it to NO.
Ensure you are not importing [ViewController.m] instead of header file
#import "ViewController.m"
For anyone else who is having this issue, I didn't see my resolution in any of these answers.
After having a .pbxproj merge conflict which was manually addressed (albeit poorly), there were duplicate references to individual class files in the .pbxproj. Deleting those from the Project > Build Phases > Compile Sources fixed everything for me.
Hope this helps someone down the line.
I've just had this error as well. Found that the problem was variables declared with global scope, with the same names, were being repeated throughout the files being compiled into the program. Once changing the global variables to local scope to the pseudo-main function the error was resolved.
In my case, I named an Entity of my Core Data Model the same as an Object. So: I defined an object "Event.h" and at the same time I had this entity called "Event". I ended up renaming the entity.
Make sure you haven't imported a .m file by accident, you might want to delete your derived data in the Projects Window and then build and run again.
Sometimes, this happens when you have the wrong file in import like for ex.:
import "MenuItem.m"
Instead of
import "MenuItem.h"
this will throw that duplicate error duplicate symbols for architecture x86_64
Defining same variable under @implementation in more than one class also can cause this problem.
I found the accepted answer touches on the problem but didn't help me solve it, hopefully this answer will help with this very frustrating issue.
duplicate symbol _OBJC_IVAR_$_BLoginViewController._hud in:
17 duplicate symbols for architecture x86_64
"Means that you have loaded same functions twice. As the issue disappear after removing -ObjC from Other Linker Flags, this means that this option result that functions loads twice:"
In layman's terms this means we have two files in our project with exactly the same name. Maybe you are combining one project into another one? Have a look at the errors above the "duplicate symbols" error to see which folder is duplicated, in my case it was BLoginViewController.
For example, in the image below you can see I have two BImageViewControllers, for me this is what was causing the issue.
As soon as I deleted one then the issue vanished :)
Open your project in XCode
you will see the sidebar now focus on the attached image.
Search your specific SDK or any dublicate file where you facing an issue.
You will see that you have added any file twice.
just remove that file and your issue will be resolved.
Note: you have to remove the file from that place where you add it wrongly.
Note: Just remove FBSDKCoreKit from Frameworks
Good Luck
In my case, there were two file by same name in the location
Targets > Build Phases > Compile Sources and delete any duplicate files.
This error generally occurs when you have linked any library or file twice. In the error desciption, the name of the duplicated file will be listed, you can search and and make sure you don't have duplicates. If you find duplicates, remove reference to one of them to play safe
Similar to Juice007, I had declared and initialized a C type variable in two different .m files (that weren't imported!)
BOOL myVar = NO;
however, this method of declaring and initializing a variable, even in .m, even in @implementation grants it global scope. Your options are:
Declare it as static, to limit the scope to class:
static BOOL myVar = NO;
Remove the initialization (which will make the two classes share the global var):
BOOL myVar;
-(void) init{
myVar = NO;
}
Declare it as a property:
@property BOOL myVar;
Declare it as a proper iVar in the @interface
@interface myClass(){
BOOL myVar;
}
@end
This error happened to me when I implemented a class method with a scope resolution operator in the header file, instead of .cpp file.
PS: And I was programming in C++ on Macbook Yosemite.
Fastest way to find the duplicate is:
Happens also when you declare const variables with same name in different class:
in file Message.m
const int kMessageLength = 36;
@implementation Message
@end
in file Chat.m
const int kMessageLength = 20;
@implementation Chat
@end
Same issue happen with me, when I was integrating the lob project inside my project.
Actually lob project also have the AFNetworking files, So I remove the .m files from lob project.
Actually .m files are conflicting with My project POd/AFNetworking/ .m files
Update answer for 2021, Xcode 12.X:
pod deintegrate
pod install
Hope this helps!
Can you try clear all plugin under the plugin folder?
It is worked for me
I just encoutered the problem. The pod deintegrate
or Removing podfile.lock
ways would be helpful for you, but try the following sequence , that may be more helpful than deintegrating the pod files
Podfile
pod install
, it will remove Pods
folder from the projectPodfile
pod install
For me, changing 'No Common Blocks' from Yes to No ( under Targets->Build Settings->Apple LLVM - Code Generation ) fixed the problem.
Source: Stackoverflow.com