<unknown>:0: error: unexpected input file:

谁都会走 提交于 2019-12-05 18:42:47

问题


I downloaded files from a separate Stack OverFlow post, and dragged the folder into my project (as a group.) The dependancies get resolved and it shows no error for code that relies on the files, but when I try to compile I get this error:

<unknown>:0: error: unexpected input file: /.../xyz.Swift
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

It might be nothing, but the files themselves in the project navigator show up as blank icons (while my project's other file have the swift red spalsh icon) despite checking in as swift files in the attribute inspector.

I've fumbled a few times with adding and deleting multiple sets of files, I checked the local dir and nothing seem out of order... is there something else that might be messing this up?

Thanks for suggestions!


回答1:


Solved - The issue was with the filename extension:

xyz .Swift will not properly link. It will be processed by xcode and solve code issues expecting it, but the linker will hiccup.

renamed files to xyz .swift -> problem solved.




回答2:


In my case it was after removing a compiler flag in a way it didn't like. Try to figure out what you changed in your compiler settings before it started acting weird. Sometimes because Xcode caches compiled code the problem doesn't immediately start after doing the change!




回答3:


I haven't seen that precise error before, but don't add files through Finder. Start over, and this time use 'New' -> 'File...' from the Xcode 'File' menu. It has to update its internal manifests to track all project files; you don't want to subvert this process.

After that you may still need to do a 'Clean' before re-building, and perhaps remove all of the DerivedData as well while Xcode is not running:

How can I safely delete in my ~/Library/Developer/Xcode/DerivedData directory?



来源:https://stackoverflow.com/questions/31816992/unknown0-error-unexpected-input-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!