C++ Programming Guide

Self-Contained Header Files

Your header files should include all the definitions that they need to be fully compilable. Make your header file self-contained by including within it all header files that contain needed definitions.


#include "another.h"
/* definitions that depend on another.h */

In general, your header files should be both idempotent and self-contained.


#ifndef HEADER_H
#define HEADER_H
#include "another.h"
/* definitions that depend on another.h */
#endif