原因:
C++ 1998 要求cout and endl被调用使用'std::cout'和'std::endl'格式,或using namespace std;

修改后:
#include<iostream>

std::cout << "Hello World!" << std::endl;

或者

#include<iostream>
using namespace std;

error: `cout' was not declared in this scope的更多相关文章

  1. error: 'LOGE' was not declared in this scope

    移植了下HAL,发现编译出现如下错误 error: 'LOGE' was not declared in this scope 比较了一下android4.1的 system/core/include ...

  2. 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 ...

  3. 【QT】error: 'SIGNAL' was not declared in this scope

    error: 'SIGNAL' was not declared in this scope  未在此范围内声明. connect(ui->Btnshowhello,SIGNAL(clicked ...

  4. [Error] 'exit' was not declared in this scope的解决方法

    新手刚开始用Linux和c++写程序,可能会出现下面的错误 error: ‘exit’ was not declared in this scope 解决方法是 添加 #include <cst ...

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

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

  6. 编译是报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 ...

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

  8. In function 'int av_clipl_int32_c(int64_t)': error: 'UINT64_C' was not declared in this scope

    cygwin下使用ndk编译jni时遇到的错误: /ffmpeg/include/libavutil/common.h: In function 'int av_clipl_int32_c(int64 ...

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

    问题: 将一个c文件改为cpp文件,其中的perror()改用C++中的std::cerr << strerror(error) << std::endl;来替换. 重新编译文 ...

随机推荐

  1. composer学习总结

    composer 简介:是php用来管理依赖(dependency)关系的工具,工具包地址:https://packagist.org 下载地址:https://getcomposer.org/  安 ...

  2. 在action中进行文件下载,下载时运行不报错,可是也不下载

    在写前端下载页面时,使用ajax方式调用action中的方法,然后就将下载内容返回js中了,所以没有下载,之后改为使用Windows.location进行下载,就没有问题了. action中代码: i ...

  3. 现代 PHP 新特性 —— 闭包

    一.概述 闭包是指在创建时封装周围状态的函数,即使闭包所在的环境的不存在了,闭包中封装的状态依然存在.闭包对象实现了__invoke()魔术方法,只要变量名后有(),PHP就会查找并调用__invok ...

  4. C# WPF开发之MVVM模式开发

    MVVM模式由Model,View,ViewModel三部分组成. Model需继承INotifyPropertyChange(属性修改通知) ViewModel负责业务逻辑,连接View和Model ...

  5. 使用js如何设置、获取盒模型的宽和高

    第一种: dom.style.width/height 这种方法只能获取使用内联样式的元素的宽和高. 第二种: dom.currentStyle.width/height 这种方法获取的是浏览器渲染以 ...

  6. EDB日志配置-慢sql记录分析

    1.打开:/postgresql的安装目录/data/postgresql.conf 2.找到并更改以下属性,其他的是方便观察设置的,注意要将属性前面的注释符'#'去掉才能生效 ★★★log_dest ...

  7. centos版本位数查看

    查看版本 cat /etc/issue cat /etc/redhat-release 查看位数 uname -a cat /proc/version   1. getconf LONG_BIT or ...

  8. C++标准模板库(STL)之Pair

    1.Pair的常用用法 pair:两个元素绑在一起作为一个合成元素.可以看成是两个元素的结构体. struct pair { typeName1 first; typeName2 second; }; ...

  9. 数据库 ACID

    ACID是指一个事务本质上有四个特点: Atomicity:原子性 Consistency:一致性 Isolation:隔离性 Durablilty:耐久性 原子性 原子性是指事务是一个不可分割的工作 ...

  10. sqlserver数据库方面的排序四大王

    --1. row_number 用法 这个函数的功能是为查询出来的每一行记录生成一个序号select row_number() over(order by stuid) as row_number,* ...