可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm developing an application in Xcode.
When I try to build, this error comes up:
ld: in /Users/theodore/Library/Developer/Xcode/DerivedData/Tower-bkpdifuqssebjdgurzmtirbxejnn/Build/Intermediates/Tower.build/Debug/Tower.build/Objects-normal/x86_64/TWRAppDelegate.o, file too small for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anyone know what's wrong?
回答1:
Stealing @martin-baulig's answer:
Try a full rebuild / clean. It's possible that the previous build has been abnormally aborted, leaving the TWRAppDelegate.o file corrupted or zero-size.
回答2:
I usually add a space (could be any character for that matter), remove it and then save. Easier and quicker than a clean/build.
回答3:
Since building a clean project may take way too long there is shorter way for those that have the access to the file that is corrupt in the cache:
- Delete the file (Remove reference)
- Build project
- Reinsert file
- Build project
Full version so you have no trouble finding the file:
- Find the file in Xcode project navigator
- Right click the file and press "show in finder" (opens a finder at the location where the file is)
- Select the file in Xcode and press backspace then click "Remove reference"
- Build project (it will fail but wait for it to finish)
- Reinsert file by dragging it from the finder into the same location you just deleted it
- Build project (should work now)
回答4:
Step 1. Go to: Project > Build Settings > Search Paths
Step 2. Set "Always Search User Paths" to Yes
Step 3. Build the project (You'll get a warning but the project will build.)
Step 4. Set "Always Search User Paths" back to No and build again to eliminate the warning
回答5:
rm -rf /Users/hostname/Library/Developer/Xcode/DerivedData
回答6:
- Add the file to the project again and run