The first LinuxC Program-general Linux technology-Linux programming and kernel information. The following is a detailed description. I searched the network for a day yesterday and tried to find out the program downloaded from the linux network to GEC2410. However, the most common reason for this is the transplantation of Bootloader, of course, I have an entry-level understanding of this east and west region. I don't want to go further, because there is no basis for C usage in linux, so I have to start with gcc.
Step into the topic:
Open the terminal ----> enter vim
[Root @ localhost root] # vim hello. c
Enter the vim command mode, press I on the keyboard to switch to the insert mode, and enter the following code:
# Include
Int main ()
{
Printf ("Hello! This is our embeded world! \ N ");
Return 0;
}
Press Esc to enter the command mode, enter: wq, the files will be saved and returned to the terminal.
The next step is preprocessing, linking, compiling, and running pulling.
[Root @ localhost root] # gcc-E hello. c-o hello. I // preprocessing
[Root @ localhost root] # gcc-S hello. I-o hello. s // compile without assembly, generate Assembly File
[Root @ localhost root] # gcc-c hello. s-o hello. o // compilation is not linked. Generate the target file
[Root @ localhost root] # gcc hello. o-o hello // generate the execution File
[Root @ localhost root] #./hello // run the execution File
Hello! This is our embeded world! // This is the output result.
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