删除重复的子目录后,没有这样的文件或目录 [英] No such file or directory after removing a duplicate subdirectory

查看:100
本文介绍了删除重复的子目录后,没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序正在模拟器和设备上构建并正常运行,但是我注意到由于某些原因,我的主目录中有一个重复的目录,也有一些重复的文件.因此,虽然我的主目录是/MyAppName,但/MyAppName/MyAppName中也有文件.

我小心地将所有非重复文件移出了子目录,删除了目录,并更新了Prefix Header和Info.plist文件的路径.我清理并构建了项目,但是从编译器中查找重复的子目录(已删除)时仍然出现错误,如下所示:

arm-apple-darwin10-llvm-gcc-4.2:/MyAppName/MyAppName/main.m:没有此类文件或目录

因为main.m现在位于/MyAppName/main.m

除了Prefix Header和Info.plist文件以外,我没有看到要查找的变量或设置.我还有其他地方应该看吗?显然,某些内容仍在引用重复的子目录,但是我看不到哪里.

解决方案

从您对项目布局的描述来看,这听起来像是Xcode 4项目. Xcode的项目配置仍然认为main.m位于/MyAppName/MyAppName中,因此您需要为此文件和其他文件更新项目配置.

在Project Navigator(左侧面板)中选择main.m,然后打开File Inspector(右侧面板).在文件"检查器的位置"标题下,单击看起来像带有文档图标的小窗口的按钮.这将允许您更新main.m的项目路径.重复其他文件.根据所拥有的文件数,可以更容易地将它们从项目中删除(使用项目导航器),请确保 not 删除它们,然后再次将它们重新添加到项目中./p>

您可能最终得到的文件位于文件系统层次结构的不同级别,因为在创建新文件时,Xcode使用Project Navigator中的选择来确定将其放置在磁盘上的位置.如果您选择了项目,则该文件将进入顶层文件夹;否则,该文件将进入顶层文件夹.如果您选择了组,则该组将进入与该组或其父级关联的任何文件夹中.

My app was building and running fine on the simulator and device, but I noticed that for some reason, I had a duplicate directory within my main directory, and some duplicate files as well. So while my main directory was /MyAppName, there were also files in /MyAppName/MyAppName.

I carefully moved any non-duplicate files out of the subdirectory, deleted the directory, and updated the paths for my Prefix Header and Info.plist files. I cleaned and built the project, however I'm still getting an error from the compiler looking in the duplicate subdirectory (which is deleted), like so:

arm-apple-darwin10-llvm-gcc-4.2: /MyAppName/MyAppName/main.m: No such file or directory

because main.m is now in /MyAppName/main.m

I don't see a variable or setting to look for other than the Prefix Header and Info.plist files. Is there somewhere else I should look? Clearly something is still referencing the duplicate subdirectory, but I don't see where.

解决方案

From your description of the project layout it sounds like this is an Xcode 4 project. Xcode's project configuration still thinks that main.m is in /MyAppName/MyAppName, so you need to update the project configuration for this file and any others.

Select main.m in the Project Navigator (left panel) and open the File Inspector (right panel). Under the Location heading on the File Inspector, click the button that looks like a small window with a document icon; this will allow you to update the project's path for main.m. Repeat with other files. Depending on how many files you have it may be easier to just remove them from the project (using the project navigator), being sure not to delete them, and then add them back to the project again.

You probably ended up with files at different levels of the filesystem hierarchy because when you create a new file, Xcode uses the selection in the Project Navigator to determine where to put it on disk. If you have the project selected, the file will go in the top level folder; if you have group selected, it will go in whatever folder is associated with that group, or one of its parents.

这篇关于删除重复的子目录后,没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆