was not declared in this scope
“was not declared in this scope”是一个错误信息,在编译的时候会遇到。其含义为标识符在其出现的地方是未被定义的。
出现该错误的时候,会同时把未定义的变量名显示出来。比如如下程序:
int main()
{
printf("%d",i);//这个i是没定义的。
}
就会显示一个'i' was not declared in this scope或者类似的错误信息出来。
对于变量和函数,如果未定义都会出现这个错误。
该错误出现时,需要根据出现该错误的行号及名称,查找对应名称变量或函数的作用,一般有如下几种可能:
1 忘记定义。写代码的时候疏忽了,导致一些变量直接使用但没有定义。只要对应定义相应的函数或变量即可。
2 拼写错误。写代码的时候,敲错了字符。比如sum敲成了Sum, average敲成averge等。对应修改即可。
3 作用域不正确。在超出变量和函数的作用域部分使用了该变量或函数。需要通过定义位置,或增加声明的手段,加大变量的作用域使其包含引用位置。
was not declared in this scope的更多相关文章
- error: 'LOGE' was not declared in this scope
移植了下HAL,发现编译出现如下错误 error: 'LOGE' was not declared in this scope 比较了一下android4.1的 system/core/include ...
- c++ - fcgio.cpp:50: error: 'EOF' was not declared in this scope - Stack Overflow
c++ - fcgio.cpp:50: error: 'EOF' was not declared in this scope - Stack Overflow fcgio.cpp:50: error ...
- 【QT】error: 'SIGNAL' was not declared in this scope
error: 'SIGNAL' was not declared in this scope 未在此范围内声明. connect(ui->Btnshowhello,SIGNAL(clicked ...
- 【error】'isnan' was not declared in this scope
error问题 'isnan' was not declared in this scope isnan在cmath中被取消宏定义: // These are possible macros impo ...
- [Error] 'exit' was not declared in this scope的解决方法
新手刚开始用Linux和c++写程序,可能会出现下面的错误 error: ‘exit’ was not declared in this scope 解决方法是 添加 #include <cst ...
- 解决Cygwin编译cocos2dx 遇到的 error: 'UINT64_C' was not declared in this scope 问题
环境工具:Win10.VS2013.cocos2d-x-2.2.6.Cygwin.ADT 问题来源:写了一个小游戏,VS2013上运行成功,就尝试着打包apk,项目导入到ADT里面,添加了cocos2 ...
- 编译是报error: 'EVNET_COME_TO_FOREGROUND' was not declared in this scope
Compile++ thumb : game_shared <= main.cpp jni/hellocpp/main.cpp: In function 'void Java_org_coco ...
- 调用ffmpeg库编译时出现common.h:175:47: error: 'UINT64_C' was not declared in this scope
解决办法 出现错误:jni/ffmpeg/libavutil/common.h:175:47: error: 'UINT64_C' was not declared in this scope 解决: ...
- ‘close’ was not declared in this scope
‘close’ was not declared in this scope ‘read’ was not declared in this scope ‘sysconf’ was not decla ...
随机推荐
- NIO的一些相关链接
Architecture of a Highly Scalable NIO-Based Server Scalable IO in Java Tricks and Tips with NIO part ...
- uva10986 堆优化单源最短路径(pas)
var n,m,s,t,v,i,a,b,c:longint;//这道题的代码不是这个,在下面 first,tr,p,q:..]of longint; next,eb,ew:..]of longint; ...
- input type=file 图片上传相关
HTML: <input type="file" name="address" onchange='PreviewImage(this)' value ...
- java读取xml文件
public ArrayList getMessage(){ String xmlFileName = null; List list = new ArrayList(); MessageBean m ...
- 转:Maven常用命令
转:Maven常用命令 Maven库: http://repo2.maven.org/maven2/ Maven依赖查询: http://mvnrepository.com/ Maven常用命令: 1 ...
- 文件编码、charset、sublime编辑器支持GBK等问题
问题一:如何让sublime3支持GBK 首先打开package control ,然后键入install package进入,搜索ConvertToUTF8安装成功后 打开要查看的GBK文件,点击菜 ...
- Flume_初识
企业架构 数据源 webserver RDBMS 数据的采集 shell.flume.sqoop job 监控和调度 hue.oozie 数据清洗及分析 mapreduce.hive 数据保存 sqo ...
- arp欺骗技术
ARP欺骗技术-获取内网目标IP访问图片! 简介: ARP(Address Resolution Protocol,地址解析协议)是一个位于TCP/IP协议栈中的网络层,负责将某个IP地址解析 ...
- Thinking in Java——笔记(14)
Type Information The need for RTTI Because it is a dynamically bound method, the proper behavior wil ...
- SQL JOIN\SQL INNER JOIN 关键字\SQL LEFT JOIN 关键字\SQL RIGHT JOIN 关键字\SQL FULL JOIN 关键字
SQL join 用于根据两个或多个表中的列之间的关系,从这些表中查询数据. Join 和 Key 有时为了得到完整的结果,我们需要从两个或更多的表中获取结果.我们就需要执行 join. 数据库中的表 ...