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-11-07
- 这个宏可以转换成函数吗? 2022-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 常量变量在标题中不起作用 2021-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 如何在 C++ 中初始化静态常量成员? 2022-01-01