1. 在VC6.0中定义类CXMLError的头文件中起始处有如下#include语句 #include <comdef.h> #include <string> class CXMLError { … } 在使用Level 4编译时,报告C4100,C4511,C4512,C4663,C4245,C4018几种Warning 2. 修改为如下: #pragma warning( push ) #pragma warning( disable : 4100 4511 4512 4663 4245 4018) #include <comdef.h> #include <string> #pragma warning( pop ) 这时产生了大量C4514警告。 3. 再修改为 #pragma warning( push ) #pragma warning( disable : 4100 4511 4512 4663 4245 4018 4514) #include <comdef.h> #include <string> #pragma warning( pop ) 结果依然如上,有大量C4514警告,少量4663,4245,4108。 4. 再修改如下: #pragma warning( disable : 4100 4511 4512 4663 4245 4018 4514) #pragma warning( push ) #include <comdef.h> #include <string> #pragma warning( pop ) 结果只余下4663, 4245, 4108 由于不能去除4663, 4245, 4108三种警告 5. 又对包含头文件修改为在Level 3编译,如下: #pragma warning( disable:4514) #pragma warning( push,3 ) #include <comdef.h> #include <string> #pragma warning( pop) 结果无警告产生。 6. 又尝试如下修改: #include <comdef.h> #pragma warning( push,3 ) #include <string> #pragma warning( pop) 结果无警告产生。 小结:1. 在防止包含头文件引起的Warning而使用#pragma warning时,应只针对产生警告的头文件进行处理,在这个问题中是<string>,这时应该在#include <string>上面加#pragma warning(push),否则可能增加其它警告,如此处产生的大量C4514 2. 在使用#pragma warning(push)后使用#pragma warning(disable: xxxx)可能无效时,可以尝试交换两个语句的顺序,这可能是VC6.0中的#pragma warning的Bug。 3. 在VC6.0中存在一些不能diable掉的Warning,如4663, 4245, 4108等。这可能是VC6.0的Bug,如已知的C4786在VC6.0中不能disable掉,使用#pragma warning(disable : 4786)之后仍然会显示警告。 |
详细解决方案
VC6使用#pragma warning的一点经验
热度:5 发布时间:2024-01-16 03:21:14.0
VC6使用#pragma warning的一点经验
2007-07-09 22:43
相关解决方案
- VS2003 proj 用VS2008编译,有个Warning ,请教是什么意思?---cl: 命令行 warning D9035 :“Wp64”选项已否决,并将在将来的版本中移除
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resourc解决办法
- PHP Warning: json_encode(): Invalid UTF-8 sequence in argument in,该如何处理
- Warning Cannot send session cookie - headers already sent.有关问题的解决(PHP的UTF-8 BOM引
- <meta http-equiv=pragma.>解决思路
- PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0 解决方法
- 登陆顺利 Warning: Cannot modify header information - headers already sent by (output
- Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES),该如何处理
- Warning: mysql_fetch_array() expects parameter 1 to be resource解决思路
- Warning: mysql_fetch_row() expects parameter 1 to be resource解决方案
- Warning: mysqli_error() expects exactly 1 parameter, 0 given in,该怎么解决
- (50分)PHP执行遇到 Warning: Cannot modify header information,解决方法
- Warning: gzinflate() [function.gzinflate]: data error in有关问题
- 解决joomla异常有关问题:Warning: Cannot modify
- php如何设置时间,php.ini如何设置时间,PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone
- 在html的<head>里加入<meta http-equiv=pragma content=no-cache>的有关问题
- 请教response.setHeader("Pragma" "public");是什么意思
- tomcat启动时报:WARNING 异常 'source' javaEE
- android初学者寻找帮助【Warning: Ignoring platform 'android-9' build.prop is m】,那位给点帮组?
- Warning: Procedure created with compilation errors,该怎么处理
- Warning:Function created with compilation errors,该怎么解决
- Warning: Procedure created with compilation errors解决思路
- "Qt Creator 2.4.1" 中 "pragma comment" 出错 LNK1181 ?
- 为什么小弟我的creator老是提示(<unknown>3154): Gtk-WARNING * Attempt to load unknown IM con
- warning()是起了什么作用,大概是如何个用法
- Warning: Attempt to present * on * which is already presenting
- warning:invalid multibyte character sequence 怎么解决
- PB5.0,编译出现异常:error C2220: warning treated as error - no object file generated
- PB5.0 编译出错:error C2220: 和接着 warning C4005: 'ZONE_INIT' : macro redefinition,该如何处理
- 弄不明白的报错:Warning[Pe550]: variable "Check_point" was set but never used 定义了未使用