error: `cout' was not declared in this scope

原因:
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

原文地址:https://www.cnblogs.com/ProtoDrive/p/9775858.html

时间: 2024-10-10 01:15:01

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

mips交叉编译 error: &#39;PTHREAD_MUTEX_ERRORCHECK_NP&#39; was not declared in this scope

在mips交叉编译时,设置互斥锁时,报以下错误,始终编译不过去. error: 'PTHREAD_MUTEX_ERRORCHECK_NP' was not declared in this scope 各种百度,相关信息一条也没有找到,实在没办法了,各种尝试. 打开linux平台和mips平台的pthread.h一对比才恍然大悟,原来在mips平台上,互斥锁类型使用的是: #define PTHREAD_MUTEX_NORMAL 0 #define PTHREAD_MUTEX_DEFAULT 0

解决Cygwin编译cocos2dx 遇到的 error: &#39;UINT64_C&#39; was not declared in this scope 问题

环境工具:Win10.VS2013.cocos2d-x-2.2.6.Cygwin.ADT 问题来源:写了一个小游戏,VS2013上运行成功,就尝试着打包apk,项目导入到ADT里面,添加了cocos2dx lib库以后,讨厌的红x消失,下来就是在cygwin里面预编译得到xxx.so文件了,但是问题来了,报错!!! jni/../../Classes/GameLayer.cpp:227:46: error: 'UINT64_C' was not declared in this scope 怎么

编译是报error: &#39;EVNET_COME_TO_FOREGROUND&#39; was not declared in this scope

Compile++ thumb  : game_shared <= main.cpp jni/hellocpp/main.cpp: In function 'void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv*, jobject, jint, jint)': jni/hellocpp/main.cpp:25:10: error: 'CCDirector' has not been declared jni/hellocpp/

【Cocos2d-x】编译Android工程时提示error: &#39;GL_LINE_SMOOTH&#39; was not declared in this scope

在Cocos2d-x项目中用到了OpenGL,使用GL_LINE_SMOOTH开启线条抗锯齿.代码如下: ccDrawColor4B(50, 26, 12, 255); // 设置线宽 glLineWidth(2.0f); // 启用线段反锯齿 glEnable(GL_LINE_SMOOTH); // 画第一条线 ccDrawLine(startPoint1,endPoint); // 画第二条线 ccDrawLine(startPoint2,endPoint); // 关闭线段反锯齿 glDi

qt-everywhere-opensource-src-4.8.1 出错:error: &#39;IPV6_MULTICAST_HOPS&#39; was not declared in this scope

在编译:qt-everywhere-opensource-src-4.8.1出现如下错误: /opt/buildroot-2011.11/arm920t/usr/bin/arm-linux-g++ -c -include .pch/release-shared-emb-arm/QtNetwork -pipe -fno-exceptions -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC

In function &#39;int av_clipl_int32_c(int64_t)&#39;: error: &#39;UINT64_C&#39; was not declared in this scope

cygwin下使用ndk编译jni时遇到的错误: /ffmpeg/include/libavutil/common.h: In function 'int av_clipl_int32_c(int64_t)': /ffmpeg/include/libavutil/common.h:178:47: error: 'UINT64_C' was not declared in this scope 解决方法: 修改头文件 /ffmpeg/include/libavutil/common.h 添加如下代

error: &#39;LOGE&#39; was not declared in this scope

移植了下HAL,发现编译出现如下错误 error: 'LOGE' was not declared in this scope 比较了一下android4.1的 system/core/include/cutils/log.h和android4.0的对应文件, 发现在4.1当中已经将所有的LOG宏前面加了一个字母A .所以出现上述编译错误. 修改HAL层源码:将LOGE   LOGD等等全部加个A 方法: `grep  LOG  -rl  .` 附上一个linux中的字符串查找替换用法: Lin

【STL源码剖析】--error: ‘power’ was not declared in this scope

#include <numeric> #include <vector> #include <iterator> #include <iostream> using namespace std; int main(int argc, char **argv) { int iArray[5] = {1, 2, 3, 4, 5}; vector<int> iVect(iArray, iArray+5); cout << accumulat

modelsim中,错误 Error: already declared in this scope ()

仿真软件modelsim中,错误 Error: already declared in this scope () 在定义这个信号前其它模块接口信号中调用了这个信号,modelsim仿真报错,通过把信号定义挪到调用模块前面问题解决. 可能是modelsim有要求,在块里边出现之前,必须先做声明.modelsim中,错误 Error: already declared in this scope (),布布扣,bubuko.com