Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 views
in Technique[技术] by (71.8m points)

c++ - Visual Studio 2013 doesn't ignore disabled warnings

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" 

EDIT: Typo in description. I do mean Warning 4996, not 4966. 4996 is in the command line as /wd"4996"

For Warning:

warning C4996: 'MBCS_Support_Deprecated_In_MFC': MBCS support in MFC is deprecated and may be removed in a future version of MFC.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

For obscure reasons, you must use #define NO_WARN_MBCS_MFC_DEPRECATION to disable this instead.

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() { }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...