linxu 上编译 cpp资料

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
这个装了吗?