the compiler compiles file a.cpp and b.cpp separately.
A header x.hpp will not be included twice in a.cpp or b.cpp - that is prevented by the guards.
The header will, however, be included (and read, parsed, compiled) in both a.cpp and b.cpp if included there. The compiler is invoked twice after all: for each file separately. Therefore it can not know anymore whatever it did in a.cpp once working on b.cpp, so it has to do the work again. And that work (including io) can be quit a bit to do, esp. if templates and template metaprogramming (like in Boost) is used a lot. (C++ unlike C headers contain nontrivial stuff...)
Bookmarks