Linker Command failed with exit code 1 (use -v to see invocation), Xcode 8, Swift 3

268,452

Solution 1

i was facing same issue today in xcode 8 version 8.3.2

right click on issue --> reveal in log

enter image description here

then you are able to check what is causing that issue

enter image description here

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!

Share:
268,452
Jake Dobson
Author by

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, 2021

Comments

  • Jake Dobson
    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!

    Here's a picture of the log:

  • Jake Dobson
    Jake Dobson about 7 years
    Oh yeah..plenty of times!
  • Jake Dobson
    Jake Dobson about 7 years
    That'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
    Jake Dobson about 7 years
    Thanks for that! Here's what I get in the log: imgur.com/vFkNJzZ
  • Jake Dobson
    Jake Dobson almost 7 years
    I 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
    KarenAnne almost 7 years
    Thanks for the Reveal in Log tip. I didn't know I could use it
  • Jake Dobson
    Jake Dobson almost 7 years
    The 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
    Charles Harring almost 7 years
    ok 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
    Jake Dobson almost 7 years
    I 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
    Ghasem Tabatabaei almost 7 years
    @JakeDobson Can you please tell me how did you solve this?
  • Jake Dobson
    Jake Dobson almost 7 years
    @GhasemTabatabaei Check my answer below
  • Jake Dobson
    Jake Dobson over 6 years
    No, I used Carthage for that reason. That's a legitimate answer that could help other people with this same error, though!
  • Jake Dobson
    Jake Dobson over 6 years
    Yes! 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
    Jake Dobson over 6 years
    Ha. 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
    mfaani over 6 years
    Yes 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
    Jake Dobson over 6 years
    Yeah, 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
    Jake Dobson over 6 years
    It 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
    Dennis Smolek almost 6 years
    I 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
    Jake Dobson over 5 years
    I 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
    Tom Oakley over 5 years
    Why is this the accepted answer? It doesn't actually answer the question, only potentially assist in reaching the solution.
  • Matt Parkins
    Matt Parkins over 5 years
    I 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
    riastrad about 5 years
    FWIW, 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
    Jake Dobson about 5 years
    why did you remove both and not just one?
  • Jake Dobson
    Jake Dobson about 5 years
    good note..but usually the console will let you know that some files are too large to be transferred?
  • Rozgonyi
    Rozgonyi over 4 years
    My 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
    Zach Folwick about 4 years
    This is not an answer.
  • user2612604
    user2612604 almost 4 years
    It saves my day! God bless you!
  • Hagai Harari
    Hagai Harari over 3 years
    can you elaborate pls on the fix?
  • Stanislav Mayorov
    Stanislav Mayorov about 3 years
    @HagaiHarari I don't remember a lot of details. I would try to unlink manually in xcode and check.