Linker Command failed with exit code 1 (use -v to

2019-01-08 11:44发布

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:

15条回答
劫难
2楼-- · 2019-01-08 12:28

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.

查看更多
\"骚年 ilove
3楼-- · 2019-01-08 12:28

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.

查看更多
小情绪 Triste *
4楼-- · 2019-01-08 12:28

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
5楼-- · 2019-01-08 12:32

did you try a clean? cmd + shift + k

查看更多
Rolldiameter
6楼-- · 2019-01-08 12:32

Select the project-> Build Phase->Link Binary with libraries and add all pod libraries.

查看更多
在下西门庆
7楼-- · 2019-01-08 12:32

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.

查看更多
登录 后发表回答