今天想起电脑上的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 ;
}

最新文章

  1. PostgreSql+PostGIS和uDig的安装
  2. qt环境下Mapx组建的编程---------regoin
  3. 如何用patch打补丁
  4. 什么是core dump linux下用core和gdb查询出现&quot;段错误&quot;的地方
  5. background-position的百分比
  6. HDOJ 1233
  7. win8 iis 安装
  8. 运行测试Caused by: java.lang.UnsatisfiedLinkError: no attach in java.library.path错误解决
  9. hdu 5535 Cake 构造+记忆化搜索
  10. 从今天开始每天刷一题,并写在这里 分类: ACM 2015-06-16 23:52 14人阅读 评论(0) 收藏
  11. PAT-乙级-1055. 集体照 (25)
  12. hdoj 1162 Eddy&#39;s picture
  13. 用expect做自动应答脚本
  14. js 增加 onclick 事件
  15. Confluence DotNet API发布
  16. Charles使用(一)
  17. mysql授权grant
  18. Android 访问地址
  19. [No0000197]Windows用户都应该知道的运行命令
  20. Oracle varchar与varchar2的区别

热门文章

  1. nodejs中判断请求来自PC端还是移动端
  2. Spring Boot + Mybatis 配置多数据源
  3. nginx常用运维日志分析命令
  4. iis站点设置错误页面返回http状态码为404而不是302或其他
  5. Java8新特性之forEach+Lambda 表达式遍历Map和List
  6. PostgreSQL 执行计划
  7. MongoDB 聚合查询报错
  8. 异常STATUS_FATAL_APP_EXIT(0x40000015)
  9. WinDbg常用命令系列---!uniqstack
  10. OJ笔记