Domanda

In an XCode project, all of my source files show up in red in the navigator. Double clicking on them does not open them in the text editor.

The file paths are all correct in the file inspector, though, and the project compiles perfectly well.

It's as if the compiler part of xcode can find the files, but the text editor part can't.

Can anyone suggest how I might fix the project so that I can open the source files in the editor?

Curiously, I've tried deleting and re-adding the them, but this doesn't seem to work. The file names still show up in red.

Any ideas?

È stato utile?

Soluzione 2

Hm. Originally, all the troublesome files had a variable in their path, e.g. $(MY_LIBRARY_LOCATION)/src/file.cpp.

Originally MY_LIBRARY_LOCATION was an absolute path ( /Users/me/my_libs'). I first tried changing it to a relative path (../../../my_libs`). This didn't help.

Finally, I opened up the XCode project file (myproj.xcodeproj/project.pbxproject) in a text editor and removed all references to the variable. Instead I hard-coded the absolute paths to all the files (e.g. /Users/me/my_libs/src/...). This solved the problem.

It's neither elegant nor portable, but, hey, it works.

Altri suggerimenti

Here is something similar that happened to me in git that may help. If you had recently changed the directory path of those files so that one of the folders in that path have a "/" in its name, that could cause your files to turn red and inaccessible.

Hope that is it.

I found this too, after moving a project to a new directory. But I changed the File Path to Absolute in file inspector and it found them all. Not sure its the best way. BUt it solved my problem quickly

(quick and dirty sorry!)

A

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top