简体   繁体   English

我删除了一个文件,Xcode给出了一个Clang错误

[英]I Deleted A File, And Xcode Is Giving A Clang Error

I imported a file (tlb.c), but then I (intentionally) deleted it. 我导入了一个文件(tlb.c),但后来我(故意)删除了它。 Now when I run the project, Xcode is giving a clang error and says that it is because it cannot find "tlb.c". 现在,当我运行项目时,Xcode发出了一个clang错误,并说这是因为它找不到“tlb.c”。 I did not edit any of the original files to reference it, so I don't see any reason why it would throw this error. 我没有编辑任何原始文件来引用它,所以我没有看到任何理由它会抛出此错误。

I deleted it because I realized that I did not download the .h file that went with it. 我删除它是因为我意识到我没有下载随附的.h文件。 I have cleaned the project, and completely restarted Xcode multiple times. 我已经清理了项目,并多次完全重启Xcode。

Here is the error it gives me: 这是它给我的错误:

clang: error: no such file or directory: '/Users/Tom/Desktop/Test64iOS Resource/Test64iOS/tlb.c'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Did you remove the file from your project as well as delete it from disk? 您是否从项目中删除了该文件并将其从磁盘中删除? If you failed to remove if from your project you'll still see it project navigator except the font will be red. 如果你没有从项目中删除if,你仍会看到它的项目导航器,除了字体是红色的。

If that's not your problem, select your project root in Project Navigator and then select "build phases." 如果这不是您的问题,请在Project Navigator中选择项目根目录,然后选择“构建阶段”。 There's a "Compile Sources" section. 有一个“编译源”部分。 See if the file is listed there and remove it. 查看该文件是否列在那里并将其删除。

Just ran into this same issue on Xcode 9.1, I checked out the "Compile Sources" section but the file wasn't listed. 刚刚在Xcode 9.1上遇到了同样的问题,我检查了“编译源代码”部分,但没有列出该文件。 I cleaned the project multiple times, tried searching my computer for the file to restore it (it wasn't anywhere to be found). 我多次清理项目,尝试在我的计算机上搜索文件以恢复它(它无处可寻)。

Finally, I just exited Xcode and came back. 最后,我刚退出Xcode并回来了。 Error gone. 错误消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM