error: ‘errno’ was not declared in this scope
来源:互联网 发布:linux命令echo使用简介 编辑:程序博客网 时间:2024/05/01 07:10
转自http://blog.csdn.net/david_xtd/article/details/9151373
问题:
将一个c文件改为cpp文件,其中的perror()改用C++中的std::cerr << strerror(error) << std::endl;来替换。
重新编译文件,出现错误:
解决办法:
1. 原来的perror()需要用到头文件<stdio.h>,而strerror()只需要用到头文件<string.h>,
所以,重新编译时,将<stdio.h>替换为<string.h>。
2. errno无疑是一个系统定义的全局变量,不是由用户来声明或定义的。
查到<errno.h>中有这样的宏定义
将头文件<errno.h>包含到程序中,重新编译,编译顺利完成。问题解决。
- error: ‘errno’ was not declared in this scope
- error: ‘errno’ was not declared in this scope
- error: '_localtime_not_threadsafe_' was not declared in this scope
- error: ‘exit’ was not declared in this scope
- error: `cout' was not declared in this scope
- error: 'UINT64_C' was not declared in this scope
- error: 'memcpy' was not declared in this scope
- error: 'memcpy' was not declared in this scope的解决
- error: ‘BYTE’ was not declared in this scope
- error: ‘closesocket’ was not declared in this scope
- error:inet_addr() was not declared in this scope
- error: ‘exit’ was not declared in this scope 的解决方法
- 关于error: ‘htons’ was not declared in this scope
- error: ‘memcpy’ was not declared in this scope 解决
- error: ‘alarm’ was not declared in this scope 解决
- error: ‘ostream_iterator’ was not declared in this scope
- error: 'glGenFramebuffersOES' was not declared in this scope
- error: 'LOGE' was not declared in this scope
- 为Apache添加MP4流媒体服务扩展
- 重要的“第一次”
- 基于storm和hadoop的广告系统研究【5】
- Ubuntu 12.04下安装搜狗拼音 + 安装搜狗皮肤
- nagios系统监控IO异常脚本
- error: ‘errno’ was not declared in this scope
- 基于物品的协同过滤推荐算法——读“Item-Based Collaborative Filtering Recommendation Algorithms”
- 判断ios中是否安装了某些软件
- hook之你我之见
- Revit 学习资源
- PHP的SOAP原理及实现
- linux下添加自签名根证书的脚本
- mysql trouble shooting---- 从库停止同步lock_wait_timeout_exceeded_try_restarting_transaction
- MySQL 获取农历月份函数