It is easy for C Programming in Linux to start from scratch.
Source: Internet
Author: User
It is easy for C Programming in Linux to start from scratch-general Linux technology-Linux programming and kernel information. The following is a detailed description. Let's start with the basic hello world Program and perform the following operations:
1. Input Source Code
$ Emacs hello. c >>> enter the emacs editor Environment
# Include >>> If you don't understand this function, read the C language books.
Int main ()
{
Rintf ("Hello World. \ n") ;>>> In the Emacs environment, press the Tab key to enable automatic indent.
Exit (0 );
}
After the input is complete, press CTRL, Press x, then press c, and finally release CTRL. >>>> The program retains and exits the emacs environment.
2. Compile, link, and run
Reference
$ Gcc? O hello. c
$./Hello >>>>./specifies the path of the program to be executed.
Hello World.
$
C program development on a linux platform has been completed.
3. debugging
If you want to use gdb to debug the program, remember to add? G Option
Reference
$ Gcc? G? O hello. c
$ Gdb hello >>>> enter the gdb debugging environment
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.