was not declared in this scop
1.变量、函数、或者类未声明或者定义。这是最简单的情况。
2.头文件相互#include时,导致了依赖关系错误。比如,头文件形成了一个环形依赖,
/***file a ****/
#ifndef FILE_A_
#define FILE_A_
#include <file b>
#endif
/****file b ***/
#ifndef FILE_B_
#define FILE_B_
#include <file a>
#endif
如果在file b中用到了file a中的变量、函数、类,那么由于#ifndef和#define的作用,file b中的#include <file a>语句将失去效果。
3.我遇到的情况:我在给头文件起名字的时候不小心和某个库中的头文件重名了,而在程序中又用来了这个库的这个头文件。这样, #ifndef XXXX 和 #ifndef XXXX中的宏重名了,我自己写的头文件就失去了效果。别的文件自然找不到这个头文件中的声明,就提示 was not decleared in this scope了
frameworks/base/tools/aidl/AST.cpp:10: error: 'fprintf' was not declared in this scope
后来发现本机的gcc g++ 是4.4版,安装4.3, 重新链接,问题解决。
apt-get install gcc-4.3 g++-4.3
进入/usr/bin
cd /usr/bin
建个软连接
ln -s gcc-4.3 gcc
ln -s g++-4.3 g++
然后进入android目录下,执行make,就可以了
was not declared in this scop相关推荐
- Qt5:报错error: ‘tr‘ was not declared in this scop
Qt5:报错error: 'tr' was not declared in this scop Qt5出现tr错误 QObject简单解释 QObject描述 Qt5出现tr错误 CMyDir.cpp ...
- Qt5:报错error: 'tr' was not declared in this scop
当使用Qt国际化翻译函数tr时,如果超出了使用范围就会出现以下情况: 国际化翻译函数tr是QObject类的静态公共成员函数,而QObject类是所有Qt对象的基类,国际化翻译函数tr只有在QObje ...
- Qt ‘tr‘ was not declared in this scop
tr()函数 1.翻译函数tr() 是QObject类的成员函数,使用tr()需要加入QObject类的头文件 出现此项问题是因为你新建的类不是QObject类,而是默认的custom 2.编译器提示 ...
- C++中出现[Error] ‘rand‘ was not declared in this scop报错
1.报错如图: 2.解决方案:添加头文件 #include <stdlib.h>
- SyntaxError: Non-ASCII character ‘\xe5‘ in file(xxlrt_1.py) on line 7, but no encoding declared;
具体报错如下: SyntaxError: Non-ASCII character '\xe5' in file /home/hly/work/python/work/xlrt_1.py on line ...
- Angular多个页面引入同一个组件报错The Component ‘MyComponentComponent‘ is declared by more than one NgModule怎么办?
有一天,我写了一个自信满满的自定义组件myComponent,在多个页面import使用了,结果控制台给我来这个 我特么裤子都脱了,你给我来这个提示是几个意思 仔细一看 The Component ' ...
- 【C++】mingw32-make+cmake:error: ‘nullptr‘ was not declared in this scope解决方法
###问题 使用cmake成功(Configuring done Generating done)后,在cmd终端中执行 mingw32-make报错: error: 'nullptr' was no ...
- IAR for msp430 MDK中 warning: #223-D: function xxx declared implicitly 解决方法
今天在EINT的范例里添加了一个函数,即eint.c中添加了一个datawrite()的函数,并在主函数main.c中调用,编译便警告 warning: #223-D: function " ...
- 报错解决: error: ‘writev’ was not declared in this scope
下午在编译paxosstore时报错如下: -> # g++ -O0 -g2 -DCERTAIN_DEBUG=0 -std=c++11 -I./ -I./src/ -I./include/ -I ...
最新文章
- P1505 [国家集训队]旅游 树链剖分
- 使用jtest工具压测Apache Traffic Server
- 华为服务器引入清空外部配置文件,云服务器还原配置文件
- ProLiant 服务器安装 Ret Hat Enterprise Linux AS 3 说明 (一)
- 消息队列怎么保证消息有没有重复消费(幂等性)?
- FreeBSD手册——配置FreeBSD内核
- sql怎么实现取当前数据以及累计7天数据_年薪60万+大佬吐血整理字节跳动大数据面试真题...
- VTK:命名颜色用法实战
- Stark 组件:快速开发神器 —— 页面显示
- 递归算法介绍及Java应用实战
- [css] 你知道css的预处理器和后处理器都有哪些吗?它们有什么区别呢?
- centos7 mysql数据库安装和配置
- Python数模笔记-PuLP库(1)线性规划入门
- 数组的几个重要方法以及如何清空数组
- CNN入门讲解:不一样的Softmax
- Python程序题练习
- 医疗项目(HIS)业务简单介绍
- 如何打印int整数的32位二进制数(位运算)
- 客官,来看看AspNetCore的身份验证吧
- JavaScript - 语言进阶