Surviving Xcode

A collection of tips to help you (and me) get through the bugs, crashes, and weirdness until it’s possible to switch IDEs, or Apple starts QAing C++.

(This is all based on my experiences with Xcode 3.0 running on OS X 10.5, Intel MacBook Pro.)

crashes on opening a project

This usually happens after a previous crash or quitting while a debugged program is hung.  Try removing the projectname.pbxindex directory, probably under obj/projectname.build.  It was suggested on the Xcode forums somewhere that if something unexpected happens during indexing, the index files become corrupted and cause a crash..  Nice.

“Warning - No location found for somefile.cpp:someLineNumber”

Is gdb (Xcode) telling you that it can’t set a breakpoint, even though you have debugging symbols enabled?  One possible cause is a struct/class defined in function scope.  This is pure speculation on my part; I suggest it because I have moved such a definition to file scope and had this error go away.  Once.

I’ve also found that *not* running the program under the debugger initially (command-y) but rather just running (command-r) and then setting the breakpoint sometimes works.

crashes when using the diagramming tools with a C++ project

Don’t even think it.  This will not only crash, but crash hard.  In one case it deleted the diagramming file I was working on.  Clearly a cunning trap set by Apple for the unwary.