Ubuntu 下 C++ 编程起步
时间:2016-11-24 03:17 来源:linux.it.net.cn 作者:IT
1. 首先安装g++
sudo apt-get install build-essential
2. 输入一个简单的cpp程序
#include <iostream>
using namespace std;
int main()
{
cout << "Hello Ubuntu!" << endl;
return 0;
}
3. 编译
david@ubuntu:~/MyTrain/CPlus$ g++ -o hello.exe hello.cpp
4. 运行
david@ubuntu:~/MyTrain/CPlus$ ./hello.exe
5. 结果
Hello Ubuntu!
(责任编辑:IT)
1. 首先安装g++ sudo apt-get install build-essential
2. 输入一个简单的cpp程序
#include <iostream>
using namespace std; int main() { cout << "Hello Ubuntu!" << endl; return 0; }
3. 编译 david@ubuntu:~/MyTrain/CPlus$ g++ -o hello.exe hello.cpp
4. 运行 david@ubuntu:~/MyTrain/CPlus$ ./hello.exe 5. 结果 Hello Ubuntu! (责任编辑:IT) |