在C++遇到有些关键字或者函数被弃用的情况,比如xxx was declared deprecated
来源:互联网 发布:网络空间的定义 编辑:程序博客网 时间:2024/05/17 01:48
在C++遇到有些关键字或者函数被弃用的情况
随着每一次C++的不断更新,可能都会有些函数或者关键字会被弃用,或者换成了其他的名字,这在编写代码的时候经常会碰到,碰到这种情况,可以在代码的第一行写上忽略此错误的句子,一般为:
#pragma warning(disable:错误编号)
如:下面这段代码中使用了strdup(),此函数的功能是讲函数中的数据拷贝到另一个变量中,这是调试程序会出现下面的错误:
错误 1 error C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. d:\c++workspace\consoleapplication5\consoleapplication5\consoleapplication5.cpp 30 1 ConsoleApplication5
此错误的编号是4996
所以我们要调试成功,可以这样写代码:
#pragma warning(disable:4996)
代码添加位置:
#include "stdafx.h"
#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
转载于:http://www.cnblogs.com/pengjun-shanghai/p/4825227.html
- 在C++遇到有些关键字或者函数被弃用的情况,比如xxx was declared deprecated
- 'function': was declared deprecated
- 'scanf' was declared deprecated,
- clCreateCommandQueue': was declared deprecated
- _tgetenv(),_tcscat() ,setmode(),_tsplitpath()等函数的 was declared deprecated 警告
- _tgetenv(),_tcscat() ,setmode(),_tsplitpath()等函数的 was declared deprecated 警告
- 在VS2005下编译was declared deprecated警告
- VC2005去掉烦人的warning C4996: '×××' was declared deprecated
- vc++ express edition中禁止XXX was declared deprecated提示信息
- warning C4996: strcpy was declared deprecated
- warning C4996: ''strcpy'' was declared deprecated
- warning C4996: 'strcpy' was declared deprecated
- error C4996: 'avcodec_free_frame': was declared deprecated
- Error 3 error C4996: 'cv::flann::Index_<T>': was declared deprecated c:\open
- warning C4996: 'sprintf' was declared deprecated see declaration of 'sprintf' 的警告消除方法
- VS2005编译VC6的工程,warning C4996: strcpy was declared deprecated
- (转)出现这样的警告 warning C4996: strcpy was declared deprecated
- VS2005 出现警告warning C4996: strcpy was declared deprecated 的解决办法
- AngularJs学习笔记(三)控制器和过滤器
- mysql-insert-Duplicate
- 【Netty4 简单项目实践】八、转发服务的实现方案
- mysql 密码变更变化(2)
- 批处理大量的txt文件
- 在C++遇到有些关键字或者函数被弃用的情况,比如xxx was declared deprecated
- iOS开发之移动直播技术秒开、直播优化经验、直播问题解析、直播知识解惑
- Linux编程基础——GDB(设置断点)
- 顺序表_循环左移
- IOS改变TABBAR高度、背景颜色
- Python中pass、continue、break、exit()的区别
- 0x02虚函数分析
- Android 混淆问题
- HashMap实现原理及源码分析