方式一: #ifndef _SOMEFILE_H_ #define _SOMEFILE_H_ .......... // 一些声明语句 #endif 方式二: #pragma once ... ... // 一些声明语句 如果使用时出现以下情况也不会出错: #include "Test1.h" // line 1 #include "Test1.h" // line 2