Fighting XCode and losing

One of the reasons I haven’t been blogging much lately (aside from enjoying my 4th of July holiday weekend and getting ready for my trip to Vancouver) was because I was spending the last two days dealing with an XCode problem which kept some of my code from compiling.

Since I’m dealing with multiple cross platform projects, there are lots of header files called StdAfx.h that are local to each project. For some reason, XCode decided to use the wrong header include path for one particular project.

I removed the offending include path from my project, cleaned all targets, and emptied XCode’s caches and tried building again… it was still using the wrong header! I opened the project.pbxproj file in a text editor and found no references to the offending path. Searching the source directory tree also showed no reference to that path. Yet when I build, the command line clearly shows that it’s using -I with the offending path, and precompiling a source file shows the wrong header being included.

I finally admitted defeat and added an #ifdef to the offending StdAfx.h to include the proper one when building a Mac version.

Leave a Comment