Related
I can't get rid of this error!
I have tried all sorts of things like clearing Derived Data(Preferences->Locations->click gray arrow to open Derived Data folder in Finder->right-click, move to trash), cleaning the project(CMD+Shift+K or Product->Clean), updating carthage and dependencies, checked other answers on StackOverflow (mostly adjustments in Build Settings/Phases), and recloned the app from github, etc.
The same project works on my collaborators computers..
EDIT:
From the current top-rated answer, I was able to debug a little further...I am still not sure how to fix though. It looks like I have something in the project twice? I looked and can't find anything showing up twice!
Here's a picture of the log:
i was facing same issue today in xcode 8 version 8.3.2
right click on issue --> reveal in log
then you are able to check what is causing that issue
Maybe you installed a pod file and you are still trying to build from the .xcodeproj file instead of .xcworkspace
the only thing that worked for me was to run pod deintegrate and pod install
did you try a clean? cmd + shift + k
Okay...So here is what solved my problem...
in App Delegate File:
#import "AppDelegate.h"
#import "DarkSkyAPI.h"
//#import "Credentials.h"
I had imported Credentials.h already in the DarkSkyAPI.m file in my project. Commenting out the extra import made the error go away!
Some things to mention and maybe help anyone in the future. #umairqureshi_6's answer did help me along the process, but did not solve it. He led to where I was able to dig out the info. I kept seeing AppDelegate and DarkSkyAPI files showing up in the error log and the information it was pulling from Credentials file was causing the error. I knew it had to be in one of these 3 files, so I immediately checked imports, because I remembered hearing that the .h carries all the imports from its .m file. Boom!
I k now the question has already been answered. But if this helps somebody save some time :
I had the same error. I checked everything to find a very small and stupid mistake from my side. I imported a core data ManagedObject custom file in a view controller of my project. I accidentally imported the .m file instead of the .h file which was causing the duplicate symbol in architecture error (linker command failed) because my .m file of properties class imports the .h file of core data class and hence causing duplicate import.
So just check if u have imported the right files before you try multiple solutions.!
A lot of solutions are mentioned above. No one worked for me(but please try above first).
Select Project -> Select Target -> Linked Framework and Libraries -> Add all pod libraries . (remove if they exist in embedded binaries)
Now remove these from Framework Folder in left file explorer of xcode.
This solved my issue.
Select the project-> Build Phase->Link Binary with libraries and add all pod libraries.
I had the same problem using Carthage for dependencies.
Just go to Select Project -> Build Settings -> Search for Enable Bitcode -> If it is selected to Yes, select No.
That solved this problem for me.
In my case the reason of the error is library which was linked two times.
I use react-native so it was linked automatically using react-native link and manually in xcode.
I had same problem.
The cause was that I declared same global variable in 2 files. So it was showing same error saying 2 duplicate symbols.
The solution was to remove those variables.
For any one having this issue with Flurry framework. This is what fixed my issue.
For me the issue was that i had imported the following files but never used them.
"libFlurryTVOS_9.2.3"
"libFlurryWatch_9.2.3"
So all I had to do was go to project target settings and remove these 2 files from the "Linked framework and libraries" section and the problem was solved.
Make sure the Find Implicit Dependencies checkbox is checked.
(Product -> Scheme -> Edit Scheme -> Build -> Find Implicit Dependencies)
I was testing the Sparkle framework with CocoaPods.
Sadly, I put pod 'Sparkle', '~> 1.21' in the PodFile in the wrong place. I put it underneath Testing (for unit tests).
Once placed in correct spot in PodFile, everything's fine.
I just had to do import Foundation!
I was using Kitura for Swift server side and kept forgetting this!
Here is my problem and solution:
I removed two files from the source code using source tree(Version controller). After applying the diff, that contains the two classes I removed, Xcode didn't add it automatically. So I got linker error.
I manually added the files, by right click on group name and select "Add files to ". Now my error got resolved.
If anyone faced the linker error regarding class file, then try to add it manually.
Did not have this problem when I built and ran on my own device. Only had this problem with simulators. I just simply restarted my computer and ran it. It worked.
In my case I have change the Target name in my Podfile So it's create the same Error for me.
Solution
Just go project-> Build Phase->Link Binary with libraries Remove the old FrameWorks by click on minus button(-) And clean and Run again. It's work me.
Remove Unwanted .framework.
The other answers didn't work for me so here I share my solution in case it might help somebody else:
My problem was that I was configuring the Podfile of my XCode-Project for the wrong platform. Changing "platform :ios" at the beginning of my Podfile to "platform :macos" worked for me to get rid of the error.
I had the same problem. If you are checking out any github project, then instead of using git clone, use git lfs clone, as sometimes, some large files are not properly cloned by using git only. Also, make sure your bitcode is disabled.
For me, the gem lock file was specifying an older version of cocoapods than the one I had installed. I had to re-branch and run bundle exec pod install instead of pod install
It seems like the issue is different for most of us, and the error message has decent info. In my case, the Deployment Target was set to 10.13 by the export MACOSX_DEPLOYMENT_TARGET=10.13 line, but I was running 10.14. So I had to switch my Deployment Target to 10.14 in General > Deployment Info, in order for the ITLibrary-related symbols to be available again.
cd /Users/foo/src/scrobble/macos/itunes-scrobble
export MACOSX_DEPLOYMENT_TARGET=10.13
... SNIP ...
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ITLibMediaItem", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_ITLibPlaylist", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_ITLibrary", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
In my case, I was producing multiple products from the same project. For one of the products, the main.m file imported a header file from another folder under the same project. But that file was not included in "Complied Sources" under "Build Phase". This caused a linker error.
After carefully comparing the "Build Phases" settings for a product that could be built successfully, I realized that the .m file of the header needs to be included in the list of "Compiled Source". My issue was resolved after adding that file. Attaching a picture for clarity. The highlighted file had to be added.
One of the reasons of this problem might be "Build Active Architecture Only". You need set to true.
IOS version in build phases of pod(in xcode) and ios version in pod file should be same (Try with 9.0)
Ok, I had the same problem just today and started googling it, when I came across this thread. I haven't finished reading the question when the answer struck my mind:
I declared a class with an empty constructor
class MyClass{
MyClass();
void func_one(){
// code
}
void func_two(){
// code
}
~MyClass(){
cout << "Deleting object" << endl;
}
};
Then I thought why not terminating (not sure if I'm correct with word selection here, but who cares) the constructor of my class with curly braces ({}). So I did:
class MyClass{
MyClass(){}
void func_one(){
// code
}
void func_two(){
// code
}
~MyClass(){
cout << "Deleting object" << endl;
}
};
The problem eliminated, my code started working perfectly.
I know, the good practice is to investigate the issue and find the real cause, but this worked for me.
I succeed to install and use Parse framework with my new project, but I can't with a "template project".
The template is just a Slide Menu from Appcoda
You can download the project here.
I have this error :
ld: framework not found Parse
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And the same for Bolts.
I don't understand what the problem is, the initial project is just some View Controllers...
When I write the code "import Parse", the error message is :
No such module 'Parse'
I tried to drag and drop the frameworks, and also to add the frameworks in "Link Binary With Libraries".
PS : I am using Xcode 7 beta, and I tried on beta 1 and 2, same issue.
Here is the solution:
There seems to be an issue with Xcode 7 beta where the search path for manually added frameworks is missing.
To fix the issue add the search path by doing the following:
Select Project
Click on Targets
Click Build Settings
Search for: Framework Search Path
Add $(PROJECT_DIR) and choose Recursive option.
The project should build now.
Thanks to this post : Link to stack
None of the proposed solutions worked for me. Eventually I found that the solution was to drag the frameworks from a source folder that did not have spaces in it's name.
E.g.
Dragging the frameworks from 'iOS SDKS' > did not work
Dragging the frameworks from 'Downloads' > worked
It's not the first time that XCode has been shown to be problematic when working with paths that contain spaces.
Ensure that Parse is included in the "Link Binary With Libraries" section under "Build Phases".
Go to your Build Phases -> Linked Binary With Libraries remove your pod framework & add it back again. That does the trick.
Even I got the same issue. In my case, somehow there were multiple frameworks added to the project, and one of the framework is empty. After removing the empty framwork it started compiling.
This can also happen if you accidentally break your framework, e.g. if the framework contained an Alias, which is no longer there.
This can happen if you zip the file, as the Alias contains a direct link to the orignal file, and isnt updated when you move the zip. E.g. in my case I recieved a zip of the opencv framework, and inside it had just the 'Versions' folder and no aliases to Headers, Resources or the binary. You can just recreate the aliases, or compile the framework from source again.
This took a while to figure out!
Hi everybody I have a Xcode project that gives me this error every time I try to build the project:
ld: xx duplicate symbols for architecture armv7 Xcode Project
clang: error: linker command failed with exit code 1...
I have googled around and most solutions say to get rid of duplicate files in the
build phase->Compile Resources section of the project or to change the import .m to .h in some files. Problem is the list of compiled resources isn't even sorted and I do not even know which files to fix since there are a lot of files in my project. Any advice on how on how to clean this up?
I have had this error sometimes, and the issue is always this. I have a static variable in the .m of one class, and another static variable with the same name in another .m. Apparently the compiler does not like it when there are two static variables with the same name, whether in different files or not. So check for any duplicate static variable names or #define macros. Also, it might not be duplicate files or files imported twice. If two different files are imported, but each has a variable or macro with the same name, there will be an error because the compiler can't figure out which one to use. The conflicting variables should be in the files mentioned in the error. Hope this helps!
There are certain Files in your project which may have been imported twice, try to analyse the error log, it must be referring the file where somewhere you must be getting an error as "YourViewCOntroller.O" its finding the double files,search for "YourViewCOntroller" in your project navigator, You need to remove these files from your Xcode project and then build again
If you are using Cocoapods like me, you may find that the other answers are not helping, because the duplicates are generated by the pod file automatically.
What worked for me was to look at the list of duplicate symbols, for example:
duplicate symbol _OBJC_METACLASS_$_AFImageCache in:
___/Build/Products/Debug-iphoneos/libPods-AFNetworking.a(UIImageView+AFNetworking.o)
___/Build/Products/Debug-iphoneos/libAFNetworking.a(UIImageView+AFNetworking.o)
ld: 214 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Then go to your project/target Build Settings -> Other Linker Flags and remove the reference to the duplicate pod (In my case, AFNetworking).
Clean, build again and it should work.
--
As far as I can tell, this may be happening because one of the other pods references AFNetworking, leading to a duplicate.
I used Swift language in my IOS application project in Xcode6 Beta6 and then I had to work on it with another computer. Then I got this error:
"clang: error: linker command failed with exit code 1 (use -v to see invocation)"
This error is shown only different computers than the computer on which I opened my project at first. It does not give an error in the first computer (which I opened and started to the project)
I tried to clean, and delete the contents of DerivedData folder, but it gives me the same error again. Below this error, it also says that "file not found:" for inside of the DerivedData folder:
file not found: /Users/macbook/Library/Developer/Xcode/DerivedData/SihirliSayilar-gmmsqkhqgygosqeuqdiibnrjasbq/Build/Products/Debug-iphonesimulator/Project.app/Project
I looked the other titles for this issue, but none of them solve this problem.
Thank you for any help!
The fact that it's a linker error should point you into the right direction. Compilation errors usually mean an error in your syntax. Linker error means that although your source files have been compiled correctly, but when the time comes to be linked with other frameworks (system frameworks, or 3rd party ones), clang cannot find them in place.
Usually, this is because a 3rd party library is missing from your system, and your project depends on it, and although it can find the header files, it cannot find the actual library file to connect to. The fact that transferring your project to other computers is giving you problems, while at your computer compiles and links correctly also strengthens the assumption that probably it's a problem with the environment you are trying to compile with and you need to install something.
To find out more about the issue, go into Xcode, go into the report navigator, and you will see logs of all the builds you have made. Check the first one (which is the last build). Scroll to the bottom, and see exactly why it didn't compile. The most common scenario is that some symbol could not be found. Check in which library this symbol belongs, then install this library to your system.
I got same error you have mentioned. I have just clean the project and build it.
It worked!
You can clean the project in Product Tab and select clean. To build select build in product tab in Xcode.
I encountered the same problem and my solution is as follow:
Close the current project in xcode --->
Go to your project file and open the project by clicking the .xcworkspace file. Note: not the .xodeproj file.
Hope this helps!
In My case it worked like this:
-> Click on the project
-> Go to "General" tab
down there
-> Go to "Linked Frameworks & Libraries"
-> Click of the "+" button , you will find something like this -> Pods_yourProjectname.framework add it
-> Then add the Frameworks that you have added from there only!
-> "Command+B" (Build your Project) and the combination "Shift+Command+K" (Clean your Project)
-> Run your Application.
Simple Solution in my case:
Product -> Clean
and then:
Product -> Run
I faced this error when I opened .xcodeproj instead of .xcworkspace while using cocoapods dependency manager.
Make sure you are opening .xcworkspace.
I had the same error, and after digging through the logs I found the error "Duplicate Symbol"...
After a heap of searching I found that I had #imported a ".m" file instead of a ".h"
Maybe this might help someone.
In my case,
I faced the same clang error when I opened myproject.xcodeproj file instead of myproject.xcworkspace by mistake after installing cocoapods to my project.
it can be anything in your code, for me it was a problem with coredata classes?:
#objc(Attribute) // the problem
class Category : NSManagedObject{
}
changed to
#objc(Category)
class Category : NSManagedObject{
}
Set Host Application to your Project Target. Also, check the Allow testing Host Application APIs is turned on.
You might have to link file recently added. In My case files were not added but it got referenced in the project. The referenced file name must be appearing in red color. first, delete the referenced file, then you can right-click on the group add the file manually.
I have an error at compile time. Seems to be weird. it worked as detail view application, but using single view doesn't seem to work.
this is the error details:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_RssArticle", referenced from:
objc-class-ref in RssXmlParser.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Try these steps:
Open your project in XCode.
In left side window/panel of XCode click on your project name on top.
Now select Target from right side panel of XCode.
Select Build Phases from right panel's top. (here other option will be Build Settings, Build Rules)
In the same panel open the "Compile sources", here check: are all the files (.m) listed? if not all files click on (+) sign in bottom to add (.m) files which is not in list
As per your error it seems RssXmlParser not there, add this and compile again
It will work fine now.
don't see anybody suggesting to go to terminal and go to the directory where the project is and run
xcodebuild -verbose
to see detailed error and just reading the error helps a lot of the time
I realized I had to use the .xcworkspace file instead of the .xcodeproj file.
Product -> Clean then Product -> Run :)
In my case, I mistakenly created a new subclass of UIView with .h and .c files instead of .h and .m files. Changing the extensions was easy, but I didn't think to change the contents of the .m files. So my .h files had
#ifndef My_Project_MPMyView_h
#define My_Project_MPMyView_h
#import <UIKit/UIKit.h>
#interface MPMyView : UIView
#end
#endif
and my .m files incorrectly had
#include <stdio.h>
When I changed my .m files to
#interface MPMyView : UIView
#end
#implementation MPMyView
#end
The linker error was fixed.
I solved the same issue because I created components as separate projects. After adding the folders to the main project, I forgot to delete the .plist, .string and extra main.m files from the imported component group directories.
Deleting these solved my issue because the app was obviously getting conflicting build commands...
I encountered this error due to duplicate filenames (I had created NSManagedObjectContext subclasses automatically in core data through the editor menu).
As of XCODE 5.0, just quit and restart and xcode should recognize this and fix it for you if you click on the yellow warning in the left hand pane
A similar error just happened to me on Xcode 6.4. Seems like an Xcode bug.
My fix was to go to the ".o" file that caused the error, uncheck and recheck target memberships that you need.
I think it might be that you are trying to create two different .C file (with main function) in one project. C only allows you to have one main entrance every project.
I don't know how it worked.But i simply closed the xcode and open again by clicking xcworkspace file and worked for me. you may try hopefully this can solve your problem thank you.
Hold down alt .
On the top toolbar go to
Product > clean build folder
Press "clean build folder" and wait for it to build and run.
It should resolve any errors in the build file.