如果你添加了ifndef, define, endif以后, 在编译c/c++文件的时候仍然报错"redefition of class", 那可能是你的预编译命令的问题. 比如, 我使用如下的预编译命令:
#ifndef FLOW_ID_H
#define FLOW_ID_H
...
#endif
这个时候就会报错. 但是如果我把FLOW_ID_H
换成FLOWID_H
, 立马就不报错了:
#ifndef FLOWID_H
#define FLOWID_H
...
#endif