问题
Say I have a.h, a.cc, and b.cc in my Visual Studio 2008 project. Both a.cc and b.cc include a.h. When I modify a.h, and build the Project, a.cc and b.cc are compiled in the Debug builds. However, that is not the case in Release builds. In the Release builds, a.cc and b.cc are compiled only if they have been modified. It seems that the compiler does not keep track of the dependencies of .cc files in the Release builds.
Is there some compiler flag that will fix this problem? If not, are there other methods to deal with this problem?
回答1:
The compiler should be doing that automatically, though the problem does arise occasionally, by touching the files, interacting with source control, or even daylight savings. In the "Build" menu, select "Clean" and that should reset all the temporary files, which should make everything re-synchronize.
Also if you change your system clock between compiles. I have to do this sometimes when testing things. – John Dibling
来源:https://stackoverflow.com/questions/12982025/how-do-i-make-sure-that-when-a-h-file-is-modified-the-cc-files-including-it-a