error C4996 : 'GetVersionExW' : 被声明为被停止使用

1)error C4996 : 'GetVersionExW' : 被声明为被停止使用

解决办法:
1、项目 >> 属性 >> C / C++ >> 常规 >> sdl检查,选择“否”
2、项目 >> 属性 C++ >> 预处理 中加入 _CRT_SECURE_NO_WARNINGS
3、#pragmawarning(disable: 4996)
类似的提示错误:
错误 C4996 'vsprintf': This function or variable may be unsafe. Consider using vsprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.


3) See documentation on how to use Visual C++ 'Checked Iterators'
解决办法:
        右键项目-->属性--> 【通用配置】/【c/c++】/ 【预处理器】中第一行 【预处理器定义】中右边点击编译 ,在最下方加入_SCL_SECURE_NO_WARNINGS 确定即可;
注意:  添加的是_SCL_SECURE_NO_WARNINGS 去掉提示错误-D_SCL_SECURE_NO_WARNINGS前面的-D ;

error C4996: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::copy':
Function call with parameters that may be unsafe - this call relies on the caller to check
that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS.
 See documentation on how to use Visual C++ 'Checked Iterators'


4) fatal error C1900: “P1”(第“20150812”版)和“P2”(第“20130802”版)之间 Il 不匹配
libmpeg.lib(mpeg-ps-enc.obj) : 找到 MSIL .netmodule 或使用 /GL 编译的模块;正在使用 /LTCG 重新启动链接;将 /LTCG 添加到链接命令行以改进链接器性能
fatal error C1900: “P1”(第“20150812”版)和“P2”(第“20130802”版)之间 Il 不匹配
LINK : fatal error LNK1257: 代码生成失败
说明 20150812说明是当前VS为2015版本的开发环境,而libmpeg.lib使用的确实VS2013版本的开发环境编译出来的lib,出现链接错误,重新编译一遍libmpeg.lib即可

6)error C2001:常量中有换行符
当前项目采用多字节编码,当出现如下的代码时候
channelInfo.strChannelName = "空";编译出错提示:常量中有换行符。当时经过多次编译,还是出现这个问题,过了一段时间,不知道又可以了。采用了一个替补的方案,进行中文字节编码,
static char szEmptyBuffer[32] = { 0xE7, 0xA9, 0xBA};//空在UTF8中的字符编码


猜你喜欢

转载自blog.51cto.com/fengyuzaitu/2491255