Question

I'm using "stdafx.h" from a folder structure (from "src/resource/font.cpp"). This compiles fine but intellisense doesn't get the file, so it is effectually disabled. Do you know if there is a workaround for this?

Was it helpful?

Solution

There's no magic involved in pre-compiled headers. Even the name stdafx.h is just a convention.

Using PCH takes two steps:

  1. Create PCH
  2. Use PCH

In step 1, the entire compile results are dumped to disk. In step 2, the compilation starts by reading back the results from step 1 and then continues with the remainder of the source file (i.e. everything after #include "stdafx.h" This is an optimization which saves the recompilation of those headers.

Intellisense doesn't need that optimization. However, it may be confuxed because you have an error within your include structure which is hidden by the PCH. E.g. the include path in step 1 and step 2 differs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top