Visual Studio 2013 doesn#39;t ignore disabled warnings(Visual Studio 2013 不会忽略禁用的警告)
问题描述
大家早上好.所以我试图在我们的 C++ 项目中禁用警告 4996.它似乎包含在如下所示的命令行中,但在编译时,仍然弹出 C4966 警告.我尝试将警告级别更改为 3,或使用/w44996,但都没有奏效.有谁知道为什么会这样?
Good morning all. So I'm attempting to disable Warning 4996 in our c++ projects. It seems to be included in the command line as shown below, but upon compiling, still pops up with the C4966 Warning. I've tried changing the warning level to 3, or using /w44996, but neither have worked. Does anyone know why this might be?
/Yu"stdafx.h" /GS- /W4 /wd"4100" /wd"4121" /wd"4201" /wd"4214" /wd"4244" /wd"4996" /Zc:wchar_t /I"C:Program Files (x86)MSBuild..Common FilesMicrosoft SharedMSEnv" /I"C:Program Files (x86)MSBuild..Common FilesDesigner" /I"D:WorkspacesMST_Sustaining_SecondInc" /I"D:WorkspacesMST_Sustaining_SecondDevelopSharedInclude" /Zi /Gm /Od /Fd"D:WorkspacesMST_Sustaining_SecondDevelopIDEGrACEDebugvc120.pdb" /fp:precise /D "_USRDLL" /D "ACE_DLL" /D "IQEDITOR_ENABLED" /D "_WINDOWS" /D "_DEBUG" /D "NTDDI_VERSION=NTDDI_WIN7" /D "_WIN32_WINNT=0x0601" /D "WINVER=0x0601" /D "_AFXDLL" /D "WIN32" /D "_SECURE_SCL=0" /D "_WINDLL" /D "_MBCS" /errorReport:prompt /GF- /WX- /Zc:forScope /RTC1 /Gd /Oi /MDd /Fa"D:WorkspacesMST_Sustaining_SecondDevelopIDEGrACEDebug" /EHs /nologo /Fo"D:WorkspacesMST_Sustaining_SecondDevelopIDEGrACEDebug" /Fp"D:WorkspacesMST_Sustaining_SecondDevelopIDEGrACEDebugace.pch"
描述中有错别字.我的意思是警告 4996,而不是 4966.4996 在命令行中为/wd"4996"
Typo in description. I do mean Warning 4996, not 4966. 4996 is in the command line as /wd"4996"
警告:
warning C4996: 'MBCS_Support_Deprecated_In_MFC': MBCS support in MFC is deprecated and may be removed in a future version of MFC.
推荐答案
看起来 #pragma warning(disable: 4996) 不会禁用 MBCS 弃用警告,因为#pragma warning(1: 4996) 在 afx.h 中的 _declspec(deprecated) 行之前
It looks like #pragma warning(disable: 4996) will not disable the MBCS deprecation warning due to the
#pragma warning(1: 4996) before the _declspec(deprecated) line in afx.h
出于不明原因,您必须使用 #define NO_WARN_MBCS_MFC_DEPRECATION 来禁用此功能.
For obscure reasons, you must use #define NO_WARN_MBCS_MFC_DEPRECATION to disable this instead.
参见 afx.h 第 28-33 行
see afx.h lines 28-33
#ifndef NO_WARN_MBCS_MFC_DEPRECATION
#ifdef _MBCS
// Warn about MBCS support being deprecated: see http://go.microsoft.com/fwlink/p/?LinkId=279048 for more information.
#pragma warning(push)
#pragma warning(1 : 4996)
inline __declspec(deprecated("MBCS support in MFC is deprecated and may be removed in a future version of MFC.")) void MBCS_Support_Deprecated_In_MFC() { }
这篇关于Visual Studio 2013 不会忽略禁用的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Visual Studio 2013 不会忽略禁用的警告
基础教程推荐
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- CString 到 char* 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
