#include最好放在
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
前面,避免不必要的错误;
例:
d:\VS2003\Vc7\include\xdebug(29) : warning C4229: 使用了记时错误 : 忽略数据上的修饰符
d:\VS2003\Vc7\include\xdebug(29) : error C2365: “new” : 重定义;以前的定义是“成员函数”
d:\VS2003\Vc7\include\xdebug(29) : error C2491: “new” : 不允许 dllimport 数据 的定义
d:\VS2003\Vc7\include\xdebug(29) : error C2078: 初始值设定项太多
d:\VS2003\Vc7\include\xdebug(29) : error C2440: “初始化” : 无法从“int”转换为“void *”
从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换
d:\VS2003\Vc7\include\xdebug(29) : error C2143: 语法错误 : 缺少“;”(在“(”的前面)
d:\VS2003\Vc7\include\xdebug(29) : error C2226: 语法错误 : 意外的“size_t”类型
d:\VS2003\Vc7\include\xdebug(30) : error C2059: 语法错误 : “)”
d:\VS2003\Vc7\include\xdebug(33) : warning C4229: 使用了记时错误 : 忽略数据上的修饰符
d:\VS2003\Vc7\include\xdebug(33) : error C2365: “new” : 重定义;以前的定义是“成员函数”
d:\VS2003\Vc7\include\xdebug(33) : error C2491: “new” : 不允许 dllimport 数据 的定义
d:\VS2003\Vc7\include\xdebug(33) : error C2078: 初始值设定项太多
d:\VS2003\Vc7\include\xdebug(33) : error C2440: “初始化” : 无法从“int”转换为“void *”
从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换
d:\VS2003\Vc7\include\xdebug(33) : error C2143: 语法错误 : 缺少“;”(在“[”的前面)
d:\VS2003\Vc7\include\xdebug(33) : error C3409: 不允许空属性块
d:\VS2003\Vc7\include\xdebug(34) : warning C4091: “” : 没有声明变量时忽略“unsigned int”的左侧
d:\VS2003\Vc7\include\xdebug(34) : error C2143: 语法错误 : 缺少“;”(在“,”的前面)
d:\VS2003\Vc7\include\xdebug(34) : error C2059: 语法错误 : “,”
d:\VS2003\Vc7\include\xdebug(34) : fatal error C1004: 遇到意外的文件结束