When I compile a c++ file that includes a precompiled header, everything works as expected
// test.c++
#include <precompiled.h>
#include <header.h>
main() {}
> g++-4.7 --std=c++11 BLAH... test.c++ -H 2>&1 | grep precompiled.h
! precompiled.h.gch
(! means that gcc found and used the precompiled header)
However, when I put #include < precompiled.h > into header.h, it doesn't work:
// test.c++
#include <header.h>
main() {}
> g++-4.7 --std=c++11 BLAH... test.c++ -H 2>&1 | grep precompiled.h
. precompiled.h
(no ! or x means that gcc failed to find the precompiled header)
What's going on? My understanding was that as long as gcc hit an #include that pointed to a header with a corresponding .gch before any C/C++ tokens, it would use the GCH, which suggests to me that a sub-include should be okay.
Am I mistaken?