如果出现这个错误,有2种可能。

1.定义**数据类型语句的前一行没有写分号,而且你在程序中调用了他。

例如以下这个语句就会报错:

#include<bits/stdc++.h>
using namespace std;
int main(){int j,k,h,n,a[100]int d;d++;
}

因为第4行后面没有写分号,而且后面用了d++。所以会报错。

2.在程序里调用的c++函数没有引进数据流。

就拿memset函数举例吧:memset需导入<iomanip>库或<bits/stdc++.h>库,如果你调用了memset函数却不导入上面的头文件,同样也会报错。

错误代码:

#include<iostream>
using namespace std;
int main(){int a[100];memset(a,0,sizeof(a));
}

正确代码:

#include<bits/stdc++.h>
using namespace std;
int main() {int a[100];memset(a,0,sizeof(a));
}

谢谢大家支持!!

c++出现 [Error] ** was not declared in this scope类似的问题怎么办?相关推荐

  1. 编译c或c++代码出现error “***” was not declared in this scope 的解决方法

    C++ 中error: 'exit' was not declared in this scope 的解决方法 添加头文件#include <cstdlib> error: 'inet_n ...

  2. 【C++】mingw32-make+cmake:error: ‘nullptr‘ was not declared in this scope解决方法

    ###问题 使用cmake成功(Configuring done Generating done)后,在cmd终端中执行 mingw32-make报错: error: 'nullptr' was no ...

  3. ndk error: malloc was not declared in this scope

    error: 'malloc' was not declared in this scope 解决方法: NDK_TOOLCHAIN_VERSION=4.8 APP_CPPFLAGS += -frtt ...

  4. 解决Cygwin编译cocos2dx 遇到的 error: 'UINT64_C' was not declared in this scope 问题

    环境工具:Win10.VS2013.cocos2d-x-2.2.6.Cygwin.ADT 问题来源:写了一个小游戏,VS2013上运行成功,就尝试着打包apk,项目导入到ADT里面,添加了cocos2 ...

  5. 调用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 解决: ...

  6. 文档源代码opencv 中的错误error: ‘SurfFeatureDetector’ was not declared in this scope

    本篇文章朋友在青岛游玩的时候突然想到的...最近就有想写几篇关于文档源代码的文章,所以回家到之后就奋笔疾书的写出来发布了     这是文档中的源代码,:但是译编的时候会有一下错误:     error ...

  7. error: 'NULL' was not declared in this scope

    编译时出现这个错误: error: 'NULL' was not declared in this scope 解决方式: 在文件开头添加如下代码: #include <stddef.h> ...

  8. 【已解决】error: ‘CV_GRAY2BGR’ was not declared in this scope

    这是运行高翔 slambook2 代码出现的问题,有两种方法解决. error: 'CV_GRAY2BGR' was not declared in this scope /home/diyu/sla ...

  9. error: ‘ULONG_MAX’ was not declared in this scope

    在编译.cpp文件时,出现错误: error: 'ULONG_MAX' was not declared in this scope 解决方法:在.h文件中添加头文件,#include  <cl ...

最新文章

  1. 计算机英语四六级对调剂有影响吗,英语四六级对考研有什么影响?不过会被歧视吗?...
  2. gRPC学习记录(五)--拦截器分析
  3. [一]RabbitMQ-客户端源码之ConnectionFactory
  4. 测试软件项目的方法,保证项目测试进度的几个方法
  5. css 图片换行_好程序员web前端学习路线分享CSS浮动-文档流篇
  6. 实例39:python
  7. 【转】ABP源码分析四十二:ZERO的身份认证
  8. 【翻译】在Ext JS应用程序中构建可维护的控制器
  9. Java Jackson
  10. C语言去除字符串空格
  11. androidstudio调用系统相机为什么resultcode一直返回0_机器视觉系统原理及学习策略...
  12. 反射: 反射在中Android运用
  13. 【VM】Win10虚拟机安装Mac OS
  14. ARM汇编语言指令集汇总
  15. android指纹识别开发
  16. 浏览器书签栏的小图标设置
  17. 医用自动配药柜的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告
  18. 假想参考解码器 vbv HRD
  19. sikuli实现百度云批量离线下载
  20. 实现阿里云视频直播流程

热门文章

  1. linux vlan功能去除valn隔离的修改方法
  2. python 爬虫代码
  3. PHP | imagettftext() 函数
  4. 长沙市护照港澳通行证办理
  5. php fgets 回车符号,有时在PHP ''符号影响fgets行读取时,fget不会读取完整行
  6. 网上书城之动态实现前端界面书籍分类新书上架热销书籍
  7. 用计算机弹出来黎明前的黑暗,抖音勇敢面对生活是什么歌 黎明前的黑暗歌词...
  8. wpscan常见的使用方法
  9. kafka入门:简介、使用场景、设计原理、主要配置及集群搭
  10. MacBook Pro 2017外接显卡实战——打破Mac不能玩游戏的定律