Chinaunix首页 | 论坛 | 博客
  • 博客访问: 445246
  • 博文数量: 60
  • 博客积分: 1039
  • 博客等级: 准尉
  • 技术积分: 939
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-01 09:24
个人简介

你是我的我是大家的!

文章分类
文章存档

2013年(1)

2012年(59)

分类:

2012-10-24 19:32:31

原文地址:linux c++之using namespace std 作者:yuzhou133

#include
int main()
{
     double a;
     a=3.14159265;
     cout<<"a= "<     return 0;
}
以上是在windows下面一个c++文件的源码,但是拿到linux下面,编译的时候就有问题了,
 g++ -Wall -o float float.cpp
float.cpp:1:22: error: iostream.h: 没有那个文件或目录
float.cpp: In function ‘int main()’:
float.cpp:6: error: ‘cout’ was not declared in this scope
float.cpp:6: error: ‘endl’ was not declared in this scope
这就是上面的提示,根据提示,修改为一下的代码:
#include
using namespace std;
int main()
{
     double a;
     a=3.14159265;
     cout<<"a= "<     return 0;
}
就能进行编译了,问题解决
分析原因:This is becuase C++ 1998 requires cout and endl be called 'std::cout' and 'std::endl', or that a proper using directives such as 'using namespace std;' be used.

阅读(2200) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~