右键创建文件test.cpp 拷贝以下程序 #include <iostream> using namespace std; int main() { cout << "Hello world!" << endl; return 0; } 在终端输入: g++ test.cpp -o test //-o 参数是代表输出 运行: ./test 就会输出: Hello world!