g++编译.cpp的问题
咸魚先生 2014-09-14 01:56:57 ============= 环境 ==============
centos 6.4 gcc-g++ 4.9.0
===============================
#include <iostream>
using namespace std;
int main
{
cout<<"hello i am c++"<<endl;
return 0;
}
编译的时候报错,:
1、expected nested-name-specifier before 'namepace' using namepace std;
2、cout,在作用域中尚未声明
===================修改后==============
#include <iostream>
using namespace std;
int main
{
std::cout<<"hello i am c++"<<std::endl;
return 0;
}
编译后还是报错:
1、expected nested-name-specifier before 'namepace' using namepace std;
===================== 二次 修改后============
#include <iostream>
int main
{
std::cout<<"hello i am c++"<<std::endl;
return 0;
}
最后才编译成功,,
请问一下为什么会这样呢,能不能像在windows下那样
#include <iostream>
using namespace std;
int main
{
cout<<"hello i am c++"<<endl;
return 0;
}