VS 2005 does not detect changes in C ++ project header files

Very often, in most cases, Visual Studio2005 does not detect that some of the headers included in some project in the CPP C ++ file have been changed. As a result, it will not recompile the project, unless the title is changed.

It does not depend on the settings of the “precompiled headers”. This does not happen in VS 2006, but in every version of VS 2005 and VS 2008 this happens. This happens for all projects, not some specific ones.

This does not happen if the header file is part of the project, that is, if it appears in the vcproj file

The only way to solve the problem is to perform a clean build.

Any recommendations are greatly appreciated.

+4
source share
2 answers

In most cases (especially in C projects), this is due to the setting of the Enable Minimal Restructuring project. In "minimum recovery" mode, VS2005 tries to make more precise decisions about what needs to be rebuilt: not based on which header files were changed, but rather based on which individual class definitions were changed. In C projects (unlike C ++), this approach crashes mainly in 100% of cases, i.e. Completely ignores modified header files and never restores anything. Very annoying. I don’t know which project you are building, but maybe it can also fail in C ++ projects.

In any case, try setting Enable Minimal Restructuring to None. (This is a project setup, BTW, not a global VS setup). This should bring VS back to traditional file-based file recovery.

+4
source

First of all, VS checks only those headers that are part of your project (included in the project file / part of the file tree).

There are several header files that are handled in a very special way, for example, resource.h . At the beginning of this file there is a comment tag that defines the file as independent. See my other question about this issue here on SO.

VS also caches class dependencies (which class is declared in the header that uses cpp, which header, etc.) if you use the minimal rebuilding compiler option (/ Gm if I remember correctly). See This MSDN Page in Settings compiler / gm for more details:

Minimal rebuilding is based on class definitions that do not change between included files. Class definitions must be global for the project (there must be only one definition of this class), because the dependency information in the .idb file is created for the entire project. If you have several class definitions in your project, disable minimal rebuild.

Also, I'm not sure if dependencies are resolved correctly if you use the force include setting ...

Hope this was helpful.

+2
source

All Articles