Download gcc and gcc

Source: Internet
Author: User

Download gcc and gcc

The one-step command for gcc to compile source files is

$ Gcc demo. c-o demo

In fact, this step includes four steps:

1. Preprocessing

$ Gcc-E demo. c demo. I

The Preprocessing function mainly includes macro definition, file inclusion, and Conditional compilation. Corresponding to macro-defined commands. The file contains commands and Conditional compilation commands. The Preprocessing process reads the source code, checks the statements and macro definitions that contain the preprocessing commands, and converts the source code. The pre-processing process also deletes comments and extra spaces in the program.

The pre-processing command starts. # It must be the first character of the row except for any blank characters. # Followed by the command keyword. Any number of blank characters can exist between the keyword and. A full-line statement constitutes a preprocessing command that converts the source code before the compiler compilation. 2. Compile(Compile as assembly code)
$ Gcc-S demo. I-o demo. s

3. Assembly

$ Gcc-c demo. s-o demo. o

The gas assembler compiles the assembly code into the target file.

4. Links

$ Gcc demo. o demo

The gcc connector is provided by gas and is responsible for connecting the program's target file with all the required additional target files to generate executable files. Additional target files include static and dynamic connection libraries.

 

Multi-file Compilation:

$ Gcc demo1.c demo2.c-o demo

 

Related Article

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.