Linker Command failed with exit code 1 (use -v to see invocation), Xcode 8, Swift 3
Solution 1
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
Solution 2
Maybe you installed a pod file and you are still trying to build from the .xcodeproj
file instead of .xcworkspace
Solution 3
the only thing that worked for me was to run pod deintegrate
and pod install
Solution 4
did you try a clean? cmd + shift + k
Solution 5
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!
Jake Dobson
I am focusing on Swift, Objective-C, and Unity3D. I want to build killer apps/games that are easy to use, make every day a little better, and look great! I come from Seattle and the Midwest, where I played a ton of hockey as a kid. I love anything that I haven't done or seen before, except country music. ADD consumes my brain, try and keep up!
Updated on June 02, 2021Comments
-
Jake Dobson almost 3 years
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!
-
Jake Dobson about 7 yearsOh yeah..plenty of times!
-
Jake Dobson about 7 yearsThat's literally all I get...Clicking on the text does not send me to any extra information or the location of the file where it happened like it does for most errors. Nothing in the console, it doesn't ever get to running the app because of this error..
-
Jake Dobson about 7 yearsThanks for that! Here's what I get in the log: imgur.com/vFkNJzZ
-
Jake Dobson almost 7 yearsI finally solved this. You helped lead me in the right direction! It really sucked that Xcode didn't reveal the log when clicked on...Could have saved me some time!
-
KarenAnne almost 7 yearsThanks for the Reveal in Log tip. I didn't know I could use it
-
Jake Dobson almost 7 yearsThe question has been answered. If you see my comment below, I had imported a file that had already been imported into that file. The project was in a race condition trying to reference the file twice.
-
Charles Harring almost 7 yearsok yeah it jsut didnt work for me and when i googled it this is what came up, so i thought id try and help someone else...im new to this, should i delete my answer?
-
Jake Dobson almost 7 yearsI guess not since it's already there. I'm sure somebody might find it useful. The app I was using did not use cocoapods. The thing is, this error is very common and gives little information about itself. So many solutions can be found, depending on each project.
-
Ghasem Tabatabaei almost 7 years@JakeDobson Can you please tell me how did you solve this?
-
Jake Dobson almost 7 years@GhasemTabatabaei Check my answer below
-
Jake Dobson over 6 yearsNo, I used Carthage for that reason. That's a legitimate answer that could help other people with this same error, though!
-
Jake Dobson over 6 yearsYes! This was very similar to my problem. I had the same file imported twice in my project. Rather, I imported a "fileA.h" into "fileB.h", but then imported "fileA.h" and "fileB.h" into "fileC.h", or something along those lines...So the app crashes because it does not know which to use. Definitely a good place to have a reminder for others to double check their file imports!
-
Jake Dobson over 6 yearsHa. Yeah, you will always need to at least import Foundation before you do anything! I usually import UIKit instead of Foundation, because almost always I will need to use features of UIKit and UIKit has inherits everything from Foundation for you. Imports with Objc can be pretty tricky, but it looks like you were using Swift?
-
mfaani over 6 yearsYes I was using Swift, the file at hand wasn't showing any compiler issues, but only during running the file, I ran into this issue!
-
Jake Dobson over 6 yearsYeah, I don't think it really checks for that until runtime, I could be wrong. But, it seems like it wouldn't have an issue until you were trying to access something from Foundation, couldn't find the import, then couldn't continue the process -- crash!
-
Jake Dobson over 6 yearsIt definitely seems like a file issue they are trying to hint at...Files elsewhere are not retrieving information from one another seems commonly found on this page. Thanks for your reply. Hoping it helps someone down the road!
-
Dennis Smolek almost 6 yearsI added m$ AppCenter code to an existing project and it needed Pods. No idea what was going on and had been doing it with the
.xcodeproj
for over a year.. Something this simple! -
Jake Dobson over 5 yearsI do not think this is helpful for this thread...It seems like the error is trying to get at a file issue, like importing the same thing in separate files. I find it strange you would get this error, because this is an Objective-C specific error...
-
Tom Oakley over 5 yearsWhy is this the accepted answer? It doesn't actually answer the question, only potentially assist in reaching the solution.
-
Matt Parkins over 5 yearsI got this error in C++ too. The linker error in your case was probably that the linker couldn't find the code for your constructor. I had a similar error with a function that I renamed but because Xcode 10 wouldn't open the linker log on its own, and I didn't know you could right-click and "reveal in log", I was stumped for a few minutes trying to locate the error.
-
riastrad about 5 yearsFWIW, I encountered this issue recently when building with an SDK and @FranciscoPerez's suggestion did the trick. Definitely recommend it as a first step before you get too deep into debugging.
-
Jake Dobson about 5 yearswhy did you remove both and not just one?
-
Jake Dobson about 5 yearsgood note..but usually the console will let you know that some files are too large to be transferred?
-
Rozgonyi over 4 yearsMy fix was somewhat related to this. I had recently upgraded some dependencies and the project now used CocoaPods. Previously I was always working from the project file. I opened the workspace file, which had both my project and Pods in it, and everything worked fine.
-
Zach Folwick about 4 yearsThis is not an answer.
-
user2612604 almost 4 yearsIt saves my day! God bless you!
-
Hagai Harari over 3 yearscan you elaborate pls on the fix?
-
Stanislav Mayorov about 3 years@HagaiHarari I don't remember a lot of details. I would try to unlink manually in xcode and check.