4

We are using a precompiled header to include library files such as Boost and Windows.
Our precompiled.h is included explicitly at the top of each .cpp file in order to work with the precompiled header commands (/Yc, /Yu, and /Fp). I accepted that as necessary.

Recently, however, I found /FI, which forces an include file at the top of the source file. I tried using it to force-include precompiled.h instead of including it explicitly, and sure enough, it worked.
This would allow us to omit the precompiled header (which is an implementation detail, as far as I am concerned), and only specify the actual dependencies of the file.

Unfortunately, it looks like the only way to validate that we aren't relying on implicit dependencies provided by precompiled.h is to periodically run through a build without /FI"precompiled.h" to see which files have a problem.
This is fairly onerous. Is there a better way?

mskfisher
  • 3,291
  • 4
  • 35
  • 48
  • While researching this question, I found a blog post that used [`/FI` for precompiled headers](http://cheind.wordpress.com/2010/02/21/reducing-compilation-time-precompiled-header/), but there's no mention of dependency checking. – mskfisher Jul 19 '11 at 12:30
  • I think the answer is No but will be happy if anyone proves me wrong. – Karel Petranek Jul 19 '11 at 12:36
  • If our unit tests don't use the precompiled header, they would be the canary. That's probably the right answer, but not all of our code is unit tested. – mskfisher Jul 19 '11 at 13:14

0 Answers0