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 ...
随机推荐
- Ext3日记文件系统为什么文件系统还会损坏?
问题提出 在我们产品使用的多种文件系统中,ext3文件系统问题的一致性问题比较突出(这里的文件系统一致性问题特指文件系统元数据的一致性,下同).比如下面2例ext3文件系统损坏案例: ...
- linux install StarDict
1. sudo apt-get install stardict 2. Downloads from: http://abloz.com/huzheng/stardict-dic/zh_CN/ 3. ...
- ZeroMQ接口函数之 :zmq_msg_more - 指出是不是还有更多的消息部分可以接收
ZeroMQ 官方地址 :http://api.zeromq.org/4-2:zmq_msg_more zmq_msg_more(3) ØMQ Manual - ØMQ/3.2.5 Name zmq_ ...
- ZeroMQ实例-使用ZMQ(ZeroMQ)进行局域网内网络通信
本文内容摘要:1)安装zeromq.2)实例说明使用zmq进行网络间的消息发送和接收 首先在机器中安装zmq库 步骤如下: 1)下载zeromq的源代码,ZeroMQ的官方网址:http://zero ...
- R中一切都是vector
0.可以说R语言中一切结构体的基础是vector! R中一切都是vector,vecotor的每个component必须类型一致(character,numeric,integer....)!vect ...
- innodb Lock wait timeout exceeded;
当出现:ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction,要解决是一件麻烦的事情:特别是当一个SQL ...
- iOS 循环引用
1.循环引用一般是指:A持有B,B同时持有A,从而导致死循环无法释放对象. 2.一般循环引用出现在block和delegate中,而一般解决方法就是将self变成weakSelf(强引用变成弱引用), ...
- HDU 4757 Tree(可持久化Trie+Tarjan离线LCA)
Tree Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others) Total Su ...
- android studio 2.0 GPU Debugger使用说明
GPU Debugger GPU Debugging Tools The GPU debugging tools are an experimental feature intended to hel ...
- Xcode清除缓存等
Xcode出现一些错误的时候,有时候不是代码的问题,需要清理一下Xcode的缓存或者项目的Product等: 1. Product清理 1.1 Product-Clean 1.2 Product- ...