C++中防止头文件被多次include 的常见方式有: 1) 用#ifndef ... #define ... #endif 宏 #ifndef __MYHEADER_H__#define __MYHEADER_H__ // Here is my class ... #endif 2) 用 #pragma once #pragma once // Here is my class ... 建议使用 #pragma once ,原因: 1) 代码简洁,维护性比较好. #pragma once…
The special operator defined is used in #if and #elif expressions to test whether a certain name is defined as a macro. defined name and defined (name) are both expressions whose value is 1 if name is defined as a macro at the current point in the pr…