Ubuntu 下 C++ 编程起步

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!

 

你可能感兴趣的:(ubuntu)