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