The perils of precompiled headers

I’m working on some client code today and it’s fairly typical of most ‘Visual Studio Wizard generated code’ in that it uses precompiled headers in a pretty poor way. The default wizard generated code seems to encourage people down a slippery slope of just including everything in stdafx.cpp and not worrying about the consequences. Of course, by the time the project is large enough for this to be a problem the damage is already done and it’s a nightmare to try and unpick the resulting problems.

I’ve mentioned before that I use precompiled headers in the “one true way” (see here for details). The advantage of my way is that I can always build without using precompiled headers if I want. Right now, with this client code, I want to…

I’m currently working on two cpp files and refactoring by moving code between two classes. The problem is that every time I change a header (and I’m doing that a lot) the whole project needs to be rebuilt. This leads to me having a lot of downtime during the whole refactor - compile - test cycle as the compile stage takes far too long. I’ve noticed that I’ve been browsing the web more, I’m shoving CDs into a drive to rip them and keep thinking that I should wander off and make tea. It’s quite a difference to how things are when I’m working on code that uses precompiled headers the right way where the change - compile - test cycle is very fast when I’m developing and using the ’no precompiled headers’ build configuration that I always include…

Ah well, I guess I get to catch up with some blogs this week and I doubt my hands will ache as much at the end of the day…