How to generate preprocessing, compilation and other files with GCC under Linux

Source: Internet
Author: User

"Gcc-e test.c-o test.i------> preprocessing files generate. i files. 】

  1. 1, C language Program generation process
  2. C Language Program generation process can be easily divided into: editing, preprocessing, compilation, assembly, link five order break.
  3. All of the following operations to the Hello World program for example, the source code file named T.c, the source content is as follows:
  4. #include <stdio.h>
  5. int main ()
  6. {
  7. printf ("Hello world\n");
  8. return 0;
  9. }
  10. Steps to read
  11. 2

    2. Pretreatment Order Break

    Preprocessing order is the preprocessing code in C source processing.

    GCC-E-O t.i t.c

    Steps to read
  12. 3

    3. Compile order break

    Compile order is to process the C source code into the assembly.

    Gcc-s-O t.s t.i

    Or

    Gcc-s-O t.s t.c

    Steps to read
  13. 4

    4. Assembly Order Break

    The assembly order is to process the assembly code into binary code.

    Gcc-c-O t.o t.s

    Or

    Gcc-c-O t.o t.c

    Steps to read
  14. 5

    5. Link Order break

    Link order the binary code is packaged into an executable file format that can be recognized by the operating system, and Linux is the ELF format, which is the PE format on Windows.

    Gcc-o T T.O

    Or

    Gcc-o T t.c

    Steps to read
      1. 6
      2. 6. Operation Step Break
      3. Running the order, the executable loader with the operating system is responsible for loading and executing the program.
      4. ./T

How to generate preprocessing, compilation and other files with GCC under Linux

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.