<unknown>:0: error: unexpected input file:
Asked Answered
O

4

11

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!

Obelize answered 4/8, 2015 at 18:50 Comment(0)
O
27

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.

Obelize answered 4/8, 2015 at 19:3 Comment(0)
P
8

I have more than one flags in Other Swift Flags but each flag should be separated by -D

Error/My Mistake:

enter image description here

Solution:

enter image description here

Pierrepierrepont answered 21/3, 2023 at 8:45 Comment(0)
Q
5

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!

Quadrennial answered 21/7, 2017 at 13:32 Comment(1)
If you have added something to Other Swift Flags, make sure that each flag is preceded by "-D"Any
W
0

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?

Waterbuck answered 4/8, 2015 at 18:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.