warning C4996 ‘MBCS_Support_Deprecated_In_MFC‘ MBCS support in MFC is deprecated and may be removed

1> stdafx.cpp
1>c:\program files (x86)\microsoft visual studio 14.0\vc\atlmfc\include\afx.h(38): warning C4996: ‘MBCS_Support_Deprecated_In_MFC’: MBCS support in MFC is deprecated and may be removed in a future version of MFC.
1> c:\program files (x86)\microsoft visual studio 14.0\vc\atlmfc\include\afx.h(33): note: 参见“MBCS_Support_Deprecated_In_MFC”的声明

1. 通过将NO_WARN_MBCS_MFC_DEPRECATION 预处理器定义添加到项目生成定义中,可以消除此警告。

stdafx.h

// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件

#pragma once

#define NO_WARN_MBCS_MFC_DEPRECATION


#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
#endif

#include "targetver.h"
2. 效果

编译通过

1>------ 已启动全部重新生成: 项目: Project, 配置: Debug Win32 ------
1>  stdafx.cpp
3. 微软的解释

afx.h

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

class MBCS_Deprecated_MFC
{
public:
	MBCS_Deprecated_MFC() { MBCS_Support_Deprecated_In_MFC(); }
};
#pragma warning(pop)
#endif
#endif

https://devblogs.microsoft.com/cppblog/mfc-support-for-mbcs-deprecated-in-visual-studio-2013/

MFC support for MBCS deprecated in Visual Studio 2013
July 8th, 2013
April 2017 update Regarding our work on migration to VC2015 last year, we decided to remove the warning about MBCS deprecation.We hear you and understand that too many “old and large” MFC projects depend on it and it is too costly for large projects to move to Unicode. For new or small existing projects we definitely recommend using Unicode, as it is better for modern platforms. The deprecation warning has been removed from MFC in VC2017 and we will continue to provide MBCS support in future releases. Eric Mittelette – VC++ Lib Team ====================================================================== Hello, I’m Pat Brenner, a developer on the Visual C++ Libraries team. In this blog post I want to share some information about the Microsoft Foundation Class (MFC) Library, and in particular the support of the multi-byte character set (MBCS) in MFC. MFC has many features that support building desktop apps, and MFC has supported both Unicode and MBCS for many years. However, because Unicode is so popular, and because our research shows significantly reduced usage of MBCS, we are deprecating MBCS support in MFC for Visual Studio 2013. This keeps MFC more closely aligned with the Windows SDK itself, because many of the newest controls and messages are Unicode only. A warning to this effect has been added to MFC, so when an application is built using MBCS, a deprecation warning is issued. This warning can be eliminated by adding the NO_WARN_MBCS_MFC_DEPRECATION preprocessor definition to your project build definitions. MFC is a very large library and its binary components (static and dynamic libraries and PDBs) form a large part of the total size of the Visual C++ product. The size of the MFC libraries substantially increases both download size and install time (in full install and update scenarios). In part this is because there are so many flavors of the MFC libraries: Debug/Release, Unicode/MBCS, Static/Dynamic. To address this, the MBCS libraries will only be available via a separate download, which is available here. The goal is to remove MBCS support entirely in a subsequent release. MFC would then support only Unicode. We are interested in hearing feedback about this decision, so if you have comments, please take the time to leave a response to this article. Are you using MBCS in MFC? If so, what is the reason, and is there a reason you have not converted your application to Unicode? We’re committed to supporting MFC and making sure that applications built with MFC will run on future Windows platforms. I hope you find this information useful and reassuring. Pat Brenner, Visual C++ Libraries Development Team
Visual Studio 2013中不推荐使用MFC对MBC的支持

阿凡达

2013年7月8日

2017年4月更新关于我们去年迁移到VC2015的工作,我们决定取消关于MBC的警告反对。我们听到你的话,你就会明白,太多“老的和大的”MFC项目都依赖于它,而且大型项目迁移到Unicode上成本太高。对于新的或小的现有项目,我们绝对推荐使用Unicode,因为它更适合现代平台。在VC2017中,弃用警告已从MFC中删除,我们将在将来的版本中继续提供MBCS支持。Eric Mittelette --VC++LIB团队合作,我是Pat Brenner,是Visual C++图书馆团队的开发者。在这篇博文中,我想分享一些关于microsoftfundationclass(MFC)库的信息,尤其是MFC中对多字节字符集(MBCS)的支持。MFC有许多支持构建桌面应用的特性,并且MFC多年来一直支持Unicode和MBCS。但是,由于Unicode非常流行,而且我们的研究表明MBC的使用量显著减少,所以我们不赞成MFC for Visual Studio 2013中对MBCS的支持。这使得MFC与windowsdk本身更加紧密地结合在一起,因为许多最新的控件和消息都是Unicode格式的。在MFC中已经添加了一个警告,因此当使用MBCS构建应用程序时,将发出一个弃用警告。通过将NO_WARN_MBCS_MFC_deprecision预处理器定义添加到项目生成定义中,可以消除此警告。MFC是一个非常大的库,它的二进制组件(静态和动态库和PDBs)构成VisualC++产品的总大小的很大一部分。MFC库的大小大大增加了下载大小和安装时间(在完全安装和更新场景中)。在某种程度上,这是因为MFC库有很多风格:Debug/Release、Unicode/MBCS、Static/Dynamic。为了解决这个问题,MBCS库只能通过单独的下载获得,这里提供。目标是在后续版本中完全删除MBCS支持。MFC将只支持Unicode。我们有兴趣听取有关这一决定的反馈,因此,如果你有意见,请花时间对这篇文章作出回应。你在MFC中使用MBCS吗?如果是,原因是什么?还有没有将应用程序转换为Unicode的原因?我们致力于支持MFC,并确保用MFC构建的应用程序能够在未来的Windows平台上运行。我希望你觉得这些信息有用而且令人放心。Pat Brenner,VisualC++开发团队

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值