Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such file or directory after removing a duplicate subdirectory

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.

like image 231
Bill Weakley Avatar asked Jun 13 '11 17:06

Bill Weakley


2 Answers

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.

like image 144
Adam Preble Avatar answered Sep 20 '22 03:09

Adam Preble


I had this problem when moving files around in my project. Go to the project's build settings and search for main.m. Then fix that setting.

like image 37
Alexsander Akers Avatar answered Sep 21 '22 03:09

Alexsander Akers