[ios] Duplicate Symbols for Architecture arm64

When I try running my Xcode Project it fails with an error stating that I have duplicate symbols. I looked online where the find these duplicates but have had no luck:

enter image description here

Any ideas how to fix this?

This question is related to ios objective-c xcode linker-errors

The answer is


If you are moving to Xcode 7 or 8 and are opening a really old project, I've encountered this problem:

in SomeConstFile.h

NSString * const kAConstant;

in SomeConstFile.m

NSString *const kAConstant = @"a constant";

Earlier versions of the compiler assumed that the definition in the header file was extern and so including SomeConstFile.h all over the place was fine.

Now you need to explicitly declare these consts as extern:

in SomeConstFile.h

extern NSString * const kAConstant;

to solve this problem go to Build phases and search about duplicate file like (facebookSDK , unityads ) and delete (extension file.o) then build again .


The problem for me was I had manually included a framework but then also included that same framework in CocoaPods not knowing I did so. Once I removed one or the other, the problem went away


check your include file, I had this issue because I accidentally #imported "filename.m" instead of "filename.h", autocorrect (tab) put an "m" not "h".



Plz Change setting.

Step 1: Go to TARGETS -> Build Settings -> No Common Blocks -> No

Step 2: Go to TARGETS -> Build Settings -> enable testability -> No


For me, the issue was the style of creation of const, that worked fine until this iOS8.. i had a few lines as:

int const kView_LayoutCount = 3;

in my .h file. Six lines like resulted in 636 linker files once common blocks was set to NO. (14k+ if YES). Moved the lines to .m after stripping .h of the value declaration and compilation was good to go.

Hope this helps others!


Another Solution is to:

Select Project -> Target -> Build phase -> Compile source -> search for the file which is mentioned in the 3rd last error line (In your case BFAppLinkReturnToRefererView.o).

Then you will see either 1 or 2 files in search result.

Remove one of them and compile again. It should recompile now because there is only one file left and no more conflicts for build.

If that doesnt work the file probably has errors in it and you should remove all of them and then recompile. It should work again.


If someone is experimenting this working on Flutter, don't try to pod deintegrate, pod init.

How I solved is running flutter clean, flutter run -d [iOS Device]

Hope can help somebody.


I've messed up my pods while downgrading a pod and I've managed to resolve the issue with duplicate symbols for architecture arm64 by removing the pods and installing them again with:

pod deintegrate
pod install

Below Patch work for me..:)

Step 1: Go to TARGETS -> Build Settings -> No Common Blocks -> No

Step 2: Go to TARGETS -> Build Settings -> enable testability -> No

Setting it back to NO solved the problem!


For me it helped to switch the "No Common Blocks" compiler setting to NO: It pretty much seems to make sense, the setting is explained here: What is GCC_NO_COMMON_BLOCKS used for?


For me, I created a method called sampleMethod in ViewController_A and created the same method in ViewController_B too, It caused me this error, then i changed the method name in ViewController_B to secondSampleMethod. It fixed the error.

Seems like a Good feature to reduce the code and not to duplicate the same code in many places.

I tried changing the No Common blocks from Yes to No then enabling testability from Yes to No. It didn't worked. I Checked duplicate files also in build phases, but there is no duplicate files.


I got this issue when I had two files that had the same name on accident (large project, oops!)

Ironically they were actually the same file, I just had forgotten that I had already created one as a placeholder weeks earlier and gave it the same name again, haha!


For me it was that i imported a file as a .m not a .h by mistake


From the errors, it would appear any Classes appear multiple time.Find and removed that Classes it will working.

Am creating AppDelegate.h and .m file creating multiple time. So this error will occur.Finally find and removed that classes it's working fine for me.


This error happens when Linker is trying to link the obj files. Few reasons that i could think of for this error are:

  1. The duplicated Function/Class is defined at two different places/files in the project and only one of them was supposed to compile for any variation of build command. But somehow both those files got compiled in your project. So you need to check your if-else conditions or other dependencies which adds src files to the list of files needed to be compiled and remove the un-needed file for your particular build command.

  2. The duplicated Function/Class is defined accidentally at two different places/files in the project. Remove the wrong definition.

  3. Clean your OBJ directory before you build again, there could be some old obj files in there from your previous builds which might be causing this conflict.

P.S i am no expert, but this is how i solved this problem when i faced it. :)


In my case reason was too stupid :

I had a Constant.h file where I had macros defined. I thought of doing NSString there. and did this :

NSString const *kGreenColor = @"#00C34E";

this caused the problem of Duplicate Symbols for Architecture arm64 and Linker command failed with exit code 1. Removing const NSString line worked for me.


Well, some times when using SDK like FB or Libraries like Vuforia or GoogleAnalytics , adding sample projects may cause the problem that they're already including Frameworks and like so ,so you must make sure not repeating symbols you add manually while they're already included in samples


I was able to resolve this error which said "158 duplicate symbols for architecture armv7, 158 duplicate symbols for architecture arm64" --- If this is what you are getting too, then it means you are trying to compile a file which is importing or inheriting a framework or static library having references to C++ code or files. An easy way to handle this would be to change the extension of your .m file to .mm. This is how it gets handled if you are using Objective C, not sure on Swift though.

Also in your build settings - you can update the "other linker flags" to -lc++


I got this issue because I was lazily defining a variable in my .m outside of a method, then in another .m file I was defining another variable with the same name outside a method. This was causing a global variable name duplicate issue.


On upgrading to Xcode 8, I got a message to upgrade to recommended settings. I accepted and everything was updated. I started getting compile time issue :

Duplicate symbol for XXXX Duplicate symbol for XXXX Duplicate symbol for XXXX

A total of 143 errors. Went to Target->Build settings -> No Common Blocks -> Set it to NO. This resolved the issue. The issue was that the integrated projects had code blocks in common and hence was not able to compile it. Explanation can be found here.


Using Xcode 8, "Update project to recommended settings" option turned ON 'No Common Blocks' for my project.

Turning it back to OFF fixed everything up.


Examples related to ios

Adding a UISegmentedControl to UITableView Crop image to specified size and picture location Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Autoresize View When SubViews are Added Warp \ bend effect on a UIView? Speech input for visually impaired users without the need to tap the screen make UITableViewCell selectable only while editing Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Examples related to objective-c

Adding a UISegmentedControl to UITableView Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Warp \ bend effect on a UIView? Use NSInteger as array index Detect if the device is iPhone X Linker Command failed with exit code 1 (use -v to see invocation), Xcode 8, Swift 3 ITSAppUsesNonExemptEncryption export compliance while internal testing? How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem? Change status bar text color to light in iOS 9 with Objective-C

Examples related to xcode

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 iPhone is not available. Please reconnect the device Make a VStack fill the width of the screen in SwiftUI error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65 The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Xcode 10: A valid provisioning profile for this executable was not found Xcode 10, Command CodeSign failed with a nonzero exit code

Examples related to linker-errors

Duplicate Symbols for Architecture arm64 Multiple definition of ... linker error What is an undefined reference/unresolved external symbol error and how do I fix it? Why am I getting "undefined reference to sqrt" error even though I include math.h header? What causes the error "undefined reference to (some function)"? Undefined reference to 'vtable for xxx' C error: undefined reference to function, but it IS defined Undefined reference to sqrt (or other mathematical functions) Undefined reference to `sin` Linker error: "linker input file unused because linking not done", undefined reference to a function in that file