views:

178

answers:

1

The VS-IDE will write //{{NO_DEPENDENCIES}} to resource header files. This comment is actually a feature that prevents (unnecessary) rebuilding of cpp files that include the resource header.

But, like stated in the MSDN, this can lead to "undesirable side-effects".

In our project we do have the resource.h included in the stdafx.h for pre-compilation. Unfortunately the precompiled header is not rebuild, if the resource file changes...

If the NO_DEPENDENCIES is removed, it works (but it's written again, if resources are changed via IDE).

Is there a way to prevent the IDE from writing //{{NO_DEPENDENCIES}} to the resource.h file every time the file was changed?

I think the best way would be to exclude the resource.h from the precompiled header file and re-include them in the needed .h and .cpp files. This way only the affected files would need to be (manually!) rebuild and not all files (which would happen, if the pch is recompiled).

Any comments?

A: 

I agree with your own suggestion: the resource.h file should probably not be part of the precompiled header file.

Note that if applying this suggestion leads to too large compilation times, you could try to use two precompiled header files: your current one on one side, and your current one with resource.h on the other side. This latter PCH would be used only by the files that need resource.h.

Proably not too easy to maintain, though...

Xavier Nodet