Visual Studio 2013 不会忽略禁用的警告 [英] Visual Studio 2013 doesn't ignore disabled warnings

查看:28
本文介绍了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 不会忽略禁用的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆