Gcc compilation process

Source: Internet
Author: User
Gcc compilation process-general Linux technology-Linux programming and kernel information. The following is a detailed description. Implementation of gcc in C language compilation
------ Simple syntax
# Gcc cu. c-o cu
#./Cu
Result: hello world
Where: Use gcc to compile and connect the source file, and-o specifies the name of the executable file.
You can also do this:
# Gcc cu. c
#./A. out
Result: hello world
The above process seems simple, but the gcc work is far more complicated. In the execution process, preprocessing, compilation, compilation, and connection are all completed in the gcc background. First, gcc runs the pre-processing program cpp and expands it into a cu. in c, insert the content contained in the # include file, convert the pre-processed source code into the target code, and create an executable file through the Connection Program. The-E Option in gcc is usually available.
To make the display more accurate, execute the following command:
# Gcc-E cu. c-o cu. cpp
After preprocessing, gcc will compile cu. cpp into the target code. This process is implemented using the-c option of gcc.
# Gcc-x cpp-output-c cu. cpp-o cu. c
You can use gcc to compile multiple file source files into the target file.
# Gcc prt. c printf2.c-o hello
#./Hello
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.