Archive

Archive for April, 2011

Just turn off the precompiled headers option

April 22nd, 2011 Comments off

I have been bitten for years whenever I have used precompiled headers with C++ platforms. It doesn’t matter what platform I’m using, they just never quite seem to work properly and reliably. From time to time you just get bizarre error messages that just don’t make any sense. So as a matter of course I just leave that option turned off and suffer the extra compilation time.

Recently, I’ve been working with Xcode 4 which we use for our Scorecerer iPad development. Precompiled headers are enabled by default and one of the first things I did was turn that option off and forgot about it.

However, one of my partners who also just switched to Xcode 4 did not turn off that option and guess what — he just got bitten. In his case, he built an update of the product with changes that I checked into our version control system. The code compiled and built perfectly but the Xcode IDE still displayed a bunch of those red error marker icons in various places and suggested that some classes and some variables were missing. Cleaning the project and rebuilding made no difference.

My partner futzed with it for an hour or so and then told me he was having the problem. I told him to turn off the precompiled headers option. He did that, did a clean followed by build and everything is fine.

So just turn off precompiled headers. You won’t be sorry.

Categories: Software Development Tags: