xcode 我收到“clang:错误:没有输入文件”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11352507/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I'm getting "clang: error: no input files"
提问by Andrew
I had a file which I deleted and replaced with another file, somewhere else, of the same name.
我有一个文件被我删除并替换为另一个文件,在其他地方,同名。
Despite cleaning, and trying this multiple times, I keep getting this error:
尽管进行了清洁并多次尝试,但我仍然收到此错误:
clang: error: no such file or directory: '/Users/Andrew/App/Version 1.1/XCode/UIImage+Alpha.m' clang: error: no input files
clang:错误:没有这样的文件或目录:'/Users/Andrew/App/Version 1.1/XCode/UIImage+Alpha.m' clang:错误:没有输入文件
I can't continue working on my app because of it. Any ideas?
因为它,我无法继续处理我的应用程序。有任何想法吗?
回答by bandejapaisa
The problem might be because your project > target > Build Phases > Compile Sources is trying to compile a file that doesn't exist. It might be in there twice, like the below screen shot. My project contains UIImage+FFXtras, I can even remove it and re-add it and this won't resolve the problem!
问题可能是因为您的项目 > 目标 > 构建阶段 > 编译源正在尝试编译一个不存在的文件。它可能在那里两次,如下面的屏幕截图。我的项目包含 UIImage+FFXtras,我什至可以删除它并重新添加它,这不会解决问题!
I'm not sure how the project gets into this state - but I know it's not obvious what is going wrong. Highlight the red problem one and remove it.
我不确定项目是如何进入这种状态的——但我知道出了什么问题并不明显。突出显示红色问题并将其删除。
So have a look in compile sources phase for the file clang is complaining about.
因此,请查看 clang 抱怨的文件的编译源代码阶段。
回答by TocToc
Got the similar troubles.
遇到了类似的烦恼。
It seems XCode does not generate correct relative filepath when your project refer to an already existing source tree (relative path does not contain the .xcodeproj in the path of the file to be compiled).
当您的项目引用已存在的源代码树时,XCode 似乎不会生成正确的相对文件路径(相对路径不包含要编译的文件路径中的 .xcodeproj)。
There is a simple fix however: in the project explorer select the file or files files then look at the options in the file inspector. One of them is labeled "Location"; set it to absolut path and try again. This fixed the issue for me :)
然而,有一个简单的修复:在项目资源管理器中选择一个或多个文件文件,然后查看文件检查器中的选项。其中之一被标记为“位置”;将其设置为绝对路径并重试。这为我解决了这个问题:)
回答by WINSergey
Additional to all answers:
补充所有答案:
- delete derived data
- reboot
- delete derived data
- clean
- build
- Success!
- 删除派生数据
- 重启
- 删除派生数据
- 干净的
- 建造
- 成功!
Only this sequence works for me in my case.
在我的情况下,只有这个序列对我有用。
回答by phil
I use quite a few cocoa pods and have just had this happen to me. A quick "pods update" sorted things out for me. -phil
我用了很多可可豆荚,刚刚发生在我身上。一个快速的“豆荚更新”为我解决了问题。-菲尔
回答by vikingosegundo
In case everything fails (i.e. first try bames53 suggestion)
如果一切都失败了(即首先尝试 bames53 建议)
Ok, this might be dangerous so make a copy of your whole project first:
好的,这可能很危险,所以先复制你的整个项目:
- close Xcode
- locate the project file in the Finder
- right click, choose "show package contents"
- open
project.pbxproj
in a text editor of your choice, but not Xcode - search for your file
- at the beginning of the line that shows up, you'll see some id like
640450991409CF5C00B3B580
. Search for this and delete any line you find. - pay attention, not to break the syntax (balance parenthesis and brackets, pay attention for commas)
- at the beginning of the line that shows up, you'll see some id like
- when you are done, save the file and try to open the project in Xcode. Add the missing file via the
Add file…
dialog of Xcode. It is still in the folder of your project — if you added it successfully in the first place — you just got rid of all project references. - dont be surprised, if it doesnt work instantly — you have a copy. copy it again, new try.
- 关闭 Xcode
- 在 Finder 中找到项目文件
- 右键单击,选择“显示包内容”
project.pbxproj
在您选择的文本编辑器中打开,而不是 Xcode- 搜索您的文件
- 在出现的行的开头,你会看到一些像
640450991409CF5C00B3B580
. 搜索此内容并删除您找到的任何行。 - 注意,不要破坏语法(平衡括号和括号,注意逗号)
- 在出现的行的开头,你会看到一些像
- 完成后,保存文件并尝试在 Xcode 中打开项目。通过
Add file…
Xcode的对话框添加丢失的文件。它仍然在你的项目文件夹中——如果你首先成功添加了它——你只是摆脱了所有的项目引用。 - 不要惊讶,如果它不能立即生效——你有一个副本。复制一遍,新的尝试。
And remember: make a copy of your whole project first— for every try. or copying the project.pbxproj
might be enough.
并记住:首先复制你的整个项目——每次尝试。或复制project.pbxproj
可能就足够了。
回答by sfg2k
Add this line in your pod-file and run pod install:
在 pod 文件中添加这一行并运行 pod install:
use_frameworks!
回答by l.grant
I had this error in monodevelop. I just went to edit>preferences and changed the default location of the program files. It was set to the monodevelop default they give you when you open a file and not the folder i changed it too. Likely, you need to adjust the settings of xcode, where you stored your files.
我在monodevelop中遇到了这个错误。我只是去编辑>首选项并更改了程序文件的默认位置。它被设置为当你打开一个文件时他们给你的 monodevelop 默认值,而不是我改变它的文件夹。很可能,您需要调整存储文件的 xcode 设置。
回答by Rakan Bushnaq
Comment Quoted from another site was the issue is resolved for me
从另一个站点引用的评论是否为我解决了问题
hmm that's strange. Try this - click on the name of your project on the list of files/folders on the left in Xcode (at the very top of the list). Look at the "Targets" section on the left-hand side of the window to the right. Likely, there's two listed with the second being a "test" item. Right-click on that item and select "delete". Then try to run the project again. See screenshot below for a visual cue.
嗯,这很奇怪。试试这个 - 在 Xcode 左侧的文件/文件夹列表中点击你的项目名称(在列表的最顶部)。查看右侧窗口左侧的“目标”部分。可能列出了两个,第二个是“测试”项目。右键单击该项目并选择“删除”。然后尝试再次运行该项目。有关视觉提示,请参见下面的屏幕截图。