user1872384
user1872384

Reputation: 7147

can't link with a main executable file

Changed my deployment target to from 8.0 to 7.0.

Using Xcode 6 with latest iOS8 as base sdk. Getting this error when building for iOS7.1 device:

ld: can't link with a main executable file '/Users/Name/Library/Developer/Xcode/DerivedData/Clumsy_Bird-gotvuaeuyvrkzvfqpzsuxpmifimu/Build/Products/Debug-iphoneos/Clumsy Bird.app/Clumsy Bird' for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

enter image description here

How to solve this?

Upvotes: 25

Views: 16185

Answers (4)

Ann
Ann

Reputation: 892

Build settings > IOS deployment target Make sure these values are identical in app and test app targets. Works for me. screen here

Upvotes: 25

Ben Flynn
Ben Flynn

Reputation: 18932

I had a mismatch in values between on "Build Active Architecture Only" which was "Yes" for my test app, but "No" for my unit test target. Make sure these values are identical.

Upvotes: 27

Mak
Mak

Reputation: 131

I followed steps provided by "Evgeny" above, but my project build only when I unchecked "Allow testing Host Application APIs". Thanks "Evgeny"!

Upvotes: 10

Evgenii
Evgenii

Reputation: 37349

  1. Click your project in Navigator.
  2. Select your test target. Switch to general tab if not there.
  3. Select your application name from Host Application dropdown.

enter image description here

Upvotes: 78

Related Questions