现在的位置: 首页 > 综合 > 正文

error C4996

2017年07月29日 ⁄ 综合 ⁄ 共 815字 ⁄ 字号 评论关闭

问题描述:

最近使用了VS2012,在使用 stricmp和ltoa函数的时候,报出了以下错误信息

error C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.
1>          G:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\string.h(249) : 参见“stricmp”的声明


error C4996: 'ltoa': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _ltoa. See online help for details.
1>          G:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdlib.h(910) : 参见“ltoa”的声明


解决办法:

这个问题在VS 2012之前的版本中是不会当做错误的,只是提出一个警告。为了避免报错,可以使用以下两个宏定义来屏蔽掉这种错误。
#define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_NONSTDC_NO_DEPRECATE 1

error C4996: 'ltoa': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _ltoa. See online help for details.
1>          G:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdlib.h(910) : 参见“ltoa”的声明

抱歉!评论已关闭.