h3. What are the basic rules for setting the right includes for a file?
Suppose I have a class {{ChromaticGadget}} that extends {{Gadget}} and uses OS
facilities. So I have {{chromaticGadget.hpp}} and {{chromaticGadget.cpp}}. What should
go in {{includeDB}}? In particular when do you have an entry for a .hpp vs.
.cpp file, i.e. should I have:
{code}
chromaticGadget.cpp chromaticGadget.hpp
chromaticGadget.cpp gadget.hpp
chromaticGadget.cpp os.hpp
{code}
or:
{code}
chromaticGadget.cpp chromaticGadget.hpp
chromaticGadget.hpp gadget.hpp
chromaticGadget.hpp os.hpp
{code}
_Answer:_
To reduce compile times, the fewer .hpp files on the left hand side,
the better. So the first example is preferred except ... since you
inherit from {{Gadget}} (which presumably is declared in {{gadget.hpp}}),
I expect you'll have to change the second line in that stanza to
{code}
chromaticGadget.hpp gadget.hpp
{code}
Suppose I have a class {{ChromaticGadget}} that extends {{Gadget}} and uses OS
facilities. So I have {{chromaticGadget.hpp}} and {{chromaticGadget.cpp}}. What should
go in {{includeDB}}? In particular when do you have an entry for a .hpp vs.
.cpp file, i.e. should I have:
{code}
chromaticGadget.cpp chromaticGadget.hpp
chromaticGadget.cpp gadget.hpp
chromaticGadget.cpp os.hpp
{code}
or:
{code}
chromaticGadget.cpp chromaticGadget.hpp
chromaticGadget.hpp gadget.hpp
chromaticGadget.hpp os.hpp
{code}
_Answer:_
To reduce compile times, the fewer .hpp files on the left hand side,
the better. So the first example is preferred except ... since you
inherit from {{Gadget}} (which presumably is declared in {{gadget.hpp}}),
I expect you'll have to change the second line in that stanza to
{code}
chromaticGadget.hpp gadget.hpp
{code}