user2989513
user2989513

Reputation: 87

linker command failed with: ld: file not found

ld: file not found .../Library/Developer/Xcode/DerivedData/.../Universal.app/Universal

clang: error: linker command failed with exit code 1 (use -v to see invocation)

enter image description here

Can you help with this error?

Upvotes: 3

Views: 2085

Answers (5)

Roi Mulia
Roi Mulia

Reputation: 5896

Try to hit CMD-Alt-K or select Product -> Clean.

Upvotes: 2

Andrew Kachalin
Andrew Kachalin

Reputation: 228

I localize this error with simple mistake:

in my project i have 3 files: main.m, SimpleClass.h, SimpleClass.m; some project

in file main, I have written:

#import <Foundation/Foundation.h>
#import "SimpleClass.h"
#import "SimpleClass.m" //Mistake

When I erased the third line, all had built success.

Upvotes: 1

Koushik Ravikumar
Koushik Ravikumar

Reputation: 706

From the extremely long error message, Xcode is failing to link test files with the bundle. This issue occurs mainly in Xcode 7.

Try this:

Just go to the project settings (click on the File Structure icon and then the app name, and then the Tests target), click Build Settings and then scroll down until you see Test Host (or type ‘host’ in the search box).

Then clear the contents of both the Debug and Release hosts, circled below. The app should then compile without any issues.

Source

Upvotes: 0

Idrees Ashraf
Idrees Ashraf

Reputation: 1383

Quit your Xcode and restart again. It worked in my case

Upvotes: 0

Heedoo
Heedoo

Reputation: 147

This solution is not a perfect solution, but part of solution I solved with the error code. Let me introduce my solutions. I hope this writing can be helpful to someone in my cases.

Shortly, There were 2 cases.

1. The function in code might not match with your action in your storyboard.

For example, using control + drag, you make an function of an action on the button. But with some reason, your function name or parameters could change. It makes disconnection between code and action. Then error can happens.

2. Your code nearby reference code could be entangled with sth...
(I don't know exactly why...)

In my case, when the code NSString *mt = @"empty"; is embedded, the error occurs. The error isn't shown on xxx.m file, but on link message. So it's quite hard to find if you code down quickly. (In addition, I wrote the same code, NSString *mt = @"empty";, in other source file, but that doesn't make any error...?)

Upvotes: 0

Related Questions