First programming of GCC and vim in UbuntuLinux

Source: Internet
Author: User
The newly installed UbuntuLinux system has both GCC and VIM, and does not need to be installed. GCC compiles a program: # include "stdio. h "voidmain (intargc, char ** argv) {inti = 0; I-= 10; printf (" hellolinuxword \ n "); printf ("I = % d \ n", I); return;} Save As tes

The newly installed Ubuntu Linux system has both GCC and VIM.
Compile a program using GCC:
# Include "stdio. h"

Void main (int argc, char ** argv)
{
Int I = 0;
I-= 10;

Printf ("hello linux word \ n ");
Printf ("I = % d \ n", I );

Return;
}
Save as test. c
Enter gcc-o test1 test. c // test1 as the name of the output executable file on the terminal.
After no problem
Enter./test1 on the terminal to view the result.
VIM:
Enter vim test. c // test. c on the terminal as the code file entered above. It can also be a new file.
Enter the vim edit dialog box and press a to enter the edit status.

At this point, Press esc to exit the editing state, and then enter a colon (shift + colon) followed by wq, that is, enter: wq and press Enter, that is, the vim editor is released. Return to the terminal command window and enter gcc test. c // compile and generate. out file. /. out // This is the execution

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.