vs2015 debug时出现 C2039“cout”: 不是“std”的成员
2024-10-20 05:26:24
今天想起电脑上的vs2015,发现好久没用了,用了下,遇到了一个问题
由于不常用c++,还是觉得应该记录下来,以免下次遇到,不知怎么处理
新建项目Hello
Hello.cpp
#include "stdafx.h" int main()
{
std::cout << "hello world!I'm C++." << std::endl;
system("pause");
return ;
}
debug时出现
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2039 “cout”: 不是“std”的成员 Hello e:\c\hello\hello\hello.cpp 8
解决的方法:
包含命名空间std所在的头文件iostream
#include <iostream>
下面的可以正常运行
#include "stdafx.h"
#include <iostream>
int main()
{
std::cout << "hello world!I'm C++." << std::endl;
system("pause");
return ;
}
或
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout << "hello world!I'm C++." << endl;
system("pause");
return ;
}
最新文章
- PostgreSql+PostGIS和uDig的安装
- qt环境下Mapx组建的编程---------regoin
- 如何用patch打补丁
- 什么是core dump linux下用core和gdb查询出现";段错误";的地方
- background-position的百分比
- HDOJ 1233
- win8 iis 安装
- 运行测试Caused by: java.lang.UnsatisfiedLinkError: no attach in java.library.path错误解决
- hdu 5535 Cake 构造+记忆化搜索
- 从今天开始每天刷一题,并写在这里 分类: ACM 2015-06-16 23:52 14人阅读 评论(0) 收藏
- PAT-乙级-1055. 集体照 (25)
- hdoj 1162 Eddy&#39;s picture
- 用expect做自动应答脚本
- js 增加 onclick 事件
- Confluence DotNet API发布
- Charles使用(一)
- mysql授权grant
- Android 访问地址
- [No0000197]Windows用户都应该知道的运行命令
- Oracle varchar与varchar2的区别