首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

linxu 上编译 cpp资料

2012-07-23 
linxu 上编译 cpp文件有一段很简单的代码:#include iostreamusing namespace stdint main(){couthel

linxu 上编译 cpp文件
有一段很简单的代码:
#include <iostream>
using namespace std;

int main()
{
  cout<<"hello "<<endl;
  return 0;
}

然后用g++编译:
g++ test.cpp -o test 
结果是报错:
cout was not declared in this scope
endl was not declared in this scope

不知道是什么原因,但是用gcc编译.c文件是没有问题的。请各位指教。

[解决办法]
sudo apt-get install g++
[解决办法]
sudo apt-get install build-essential
这个装了吗?

热点排行