Where it is supported, #pragma once usually prevents the same file from being included twice. This avoids multiple definition errors, but it does not eliminate the case where a definition in file A depends on the contents of file B, and vise-versa. A.hpp
1 2 3
# pragma once
# include "B.hpp"
struct Manager: Entity {};
B.hpp
1 2 3
# pragma once
# include "A.hpp"
struct Entity { Manager* m; };
This case can be resolved using a forward declaration: A.hpp
1 2 3
# pragma once
# include "B.hpp"
struct Manager: Entity {};
B.hpp
1 2 3
# pragma once
struct Manager;
struct Entity { Manager* p };
Usually # pragma once is equivalent to the include-guard trick, which is more portable: A.hpp
1 2 3 4
# if ! defined YOUR_PROJECT_A_HPP_INCLUDED
# define YOUR_PROJECT_A_HPP_INCLUDED
// header contents here
# endif