1.vim hello.cpp //后缀要正确 i //进入编辑模式 #include <iostream> using namespace std; int main() { cout<<"hello world"<<endl; return 0; } 2.esc->:q //退出 3.g++ hello.cpp 4.编译生成a.out 输出 ➜ ~ ./a.out hello world