用的IDE是VC6.0,编译报错redefinition; different storage class,该怎么解决
用的IDE是VC6.0,编译报错redefinition; different storage class
源程序有这么一段
constant.h文件如下:
#ifdef __cplusplus
const int TRUE = 0
....
....
#else
#define TRUE = 0
....
....
#endif
然后我主程序
A.cpp中包含的头文件有constant.h
编译时报错:
error C2370:'TRUE' redefinition; different storage class
see declaration of 'TRUE'
------解决方案--------------------
偶遇到类似问题都是用
“每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。”
的方法解决的。
------解决方案--------------------
重复包含?
------解决方案--------------------
头文件重复包含了。加一个宏定义,防止重复编译。
源程序有这么一段
constant.h文件如下:
#ifdef __cplusplus
const int TRUE = 0
....
....
#else
#define TRUE = 0
....
....
#endif
然后我主程序
A.cpp中包含的头文件有constant.h
编译时报错:
error C2370:'TRUE' redefinition; different storage class
see declaration of 'TRUE'
------解决方案--------------------
偶遇到类似问题都是用
“每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。”
的方法解决的。
------解决方案--------------------
重复包含?
------解决方案--------------------
头文件重复包含了。加一个宏定义,防止重复编译。