C program compilation process (Linux based)

Source: Internet
Author: User

To convert a file named filename. C to a runable file, you need to perform the following steps. Take helloworld. C as an example.

Helloworld. c

|

| During the preprocessing process, GCC-e helloworld. C-o helloworld. I is obtained, and the helloworld. I file is obtained.

|

Helloworld. I

|

| Gcc-s helloworld. I in the assembly process, and the helloworld. s file is obtained.

|

Helloworld. s

|

| During the compilation process, GCC-C helloworld. s gets the helloworld. o file.

|

Helloworld. o

|

| Gcc-O helloworld. O to get the executable program helloworld

|

Helloworld

The GCC-e command can process the. c file.

The GCC-s command can process. I or. c files.

The GCC-C command can process. S,. I, or. c files.

The GCC-O command can process. O,. S,. I, or. c files.

 

Therefore, the executable program can be obtained step by step from the source program. You can also start from the intermediate step. For example, GCC-C can be compiled first, and then gcc-O can be linked to an executable program. Of course, it is generally completed in one step, GCC-O helloworld. c

So far, we can intuitively understand why C Programming textbooks say, C program compilation will go through "preprocessing", "assembly", "Compilation", and "Link" steps.

 

 

 

 

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.