1. 首先安装g++
sudo apt-get install build-essential
2. 输入一个简单的cpp程序
#include <iostream>
using namespace std;
int main()
{
cout << " Hello Ubuntu! " << endl;
return 0;
}
using namespace std;
int main()
{
cout << " Hello Ubuntu! " << endl;
return 0;
}
3. 编译
faye@faye:~/MyTrain/CPlus$ g++ -o hello.exe hello.cpp
4. 运行
faye@faye:~/MyTrain/CPlus$ ./hello.exe
5. 结果
Hello Ubuntu!