Remember the first time to write Hello World with vim

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.