vc文件include建议

本文介绍了在使用预编译头时应注意的放置#include的位置,以避免出现编译错误。通过正确的放置位置,可以确保代码正常编译,提高开发效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#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:   遇到意外的文件结束 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值