Use Emacs to write the first hello C program

Source: Internet
Author: User

(1) Open Emacs and execute
$ Emacs

(2) create a new program file. Press C-x C-F (Note: This is short for Ctrl + X, CTRL + F)
Then minibuffer appears at the bottom of the screen. The cursor prompts you to enter the file name,
The file name must contain a suffix, such as hello. cpp. Press enter to edit the source code.

(3) Compile the code. Press ESC-X (ESC + x)
Input: Compile. The minibuffer is displayed, prompting you to enter the compilation command.
By default, make-K appears in minibuffer. Delete it.
Run the command g ++-O hello. cpp and press enter to display a compilation result window.

(4) execute the generated result file. Press ESC-X (ESC + x)
Enter shell and press enter to display a command line window.
Run $./hello.

(5) return to the source code window. Press C-x
Input: B. The message "minibuffer" appears, prompting you to enter the buffer to be switched.
Enter the buffer name. If she prompts that the buffer is the window you want to go to, press Enter.

(6) If you do not want to input anything in minibuffer and execute C-G, the minibuffer is left.

(7) Kill a buffer. Press C-x
Input: K. The message "minibuffer" appears, prompting you to specify the buffer.
Enter a name and press Enter.

(8) Only the window with the current cursor is retained, and other windows are closed. Press C-x
Enter 1 (note the number 1). On the contrary, CTRL + x 2 opens two windows.

(9) When multiple windows appear on the screen, jump from one window to another and press C-x O (letter O ).

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.