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文件是没有问题的。请各位指教。