读书人

linxu 上编译 cpp资料

发布时间: 2012-07-23 09:42:19 作者: rapoo

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

读书人网 >C++

热点推荐