Well, for the sake of completeness, I will start by quoting tvanfosson's answer:
You must use the included guards:
#ifndef MYPROJECT_HEADER1_HPP_INCLUDED
#define MYPROJECT_HEADER1_HPP_INCLUDED
#endif
However, the inclusion of guards is not intended to solve problems with cyclic dependencies, they are designed to prevent multiple inclusions, which is completely different.
base.h
/ \
header1.h header2.h
\ /
class.cpp
( ) , base.h , , .
, ... , !!
, :
- "header1.hpp" > , include guard
- "header2.hpp
- "header1.hpp", , .
- "header2.hpp", , "header1.hpp", ( )
- "header1.hpp", "header2.hpp" - , , , ,
, , , , .
, - .
- ,
- "header1.h" : , 2, , header2
(), , .