c – Visual Studio 2013不会忽略禁用的警告

前端之家收集整理的这篇文章主要介绍了c – Visual Studio 2013不会忽略禁用的警告前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
大家早上好.所以我试图在我们的c项目中禁用警告4996.它似乎包含在命令行中,如下所示,但编译时,仍会弹出C4966警告.我尝试将警告级别更改为3,或使用/ w44996,但都没有工作.有人知道为什么会这样吗?
/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 Files\Microsoft Shared\MSEnv" /I"C:\Program Files (x86)\MSBuild\..\Common Files\Designer" /I"D:\Workspaces\MST_Sustaining_Second\Inc" /I"D:\Workspaces\MST_Sustaining_Second\Develop\Shared\Include" /Zi /Gm /Od /Fd"D:\Workspaces\MST_Sustaining_Second\Develop\IDE\GrACE\Debug\vc120.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:\Workspaces\MST_Sustaining_Second\Develop\IDE\GrACE\Debug\" /EHs /nologo /Fo"D:\Workspaces\MST_Sustaining_Second\Develop\IDE\GrACE\Debug\" /Fp"D:\Workspaces\MST_Sustaining_Second\Develop\IDE\GrACE\Debug\ace.pch"

编辑:描述中的错字.我的意思是警告4996,而不是4966. 4996在命令行为/ 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警告(禁用:4996)将不会禁用MBCS的弃用警告
在afx.h中_declspec(弃用)行之前的#pragma warning(1:4996)

由于模糊的原因,您必须使用#define NO_WARN_MBCS_MFC_DEPRECATION才能禁用此选项.

见afx.h第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() { }

猜你在找的C&C++相关文章