I am installing Ubuntu under VM, using Vim to write run Hello World
Open Terminal in Ubuntu
To check if g++ or GCC is installed, enter the command sudo apt-get install gcc
Check if Vim is installed, enter command to install sudo apt-get install vim
Then enter the command su root , enter the password into root mode , enter the input command VI hello.cpp return, so that a hello.cpp new file name is successfully established
This will pop up a page, press keyboard I to enter the insertion mode , you can edit the Hello.cpp program
When the edits are complete, press ESC to return to normal mode, where the keyboard cannot modify the program.
shortcut key shift+: can enter the terminal command mode, at this time input Wq to save The program
The page bounces back to the terminal, at which point the input command sudo gcc hello.cpp-o hello to compile
Where Hello.cpp is the CPP file you just built, the hello after-o is equivalent to a running program, the two cannot be the same name
Compile if the error, the terminal input VI hello.cpp into the previous compilation mode, to modify the program
Compile if there is no error, you can enter the command./hello Run the program.
Remember the first time to write Hello World with vim