In the attached image, if D.h is modified, will Visual Studio recompile A.cpp twice? Or will it be recompiled only once?
CodePudding user response:
No. Compiling a.cpp
once is sufficient to produce an object file that incorporates all the latest changes from the header files (if they are relevant to the code in a.cpp
).
Your build system should be considered to be buggy and broken if it has to compile a.cpp
twice during a single build, because the second compilation would be just redoing the same work as the first compilation and producing the same result.