can't link with a main executable file

2019-02-01 21:50发布

问题:

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)

How to solve this?

回答1:

  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.



回答2:

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.



回答3:

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



回答4:

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



标签: xcode6