gcc compiler C language

Source: Internet
Author: User

From the fourth edition of "Linux program Design", People's post and telecommunications publishing house

Compiling and debugging of C language Program
<< using GCC compilation, GDB debugging >>


Program compilation process:
Lexical analysis--parsing--Intermediate code generation--code optimization--Target code generation
GCC compilers:
Preprocessing (preprocessing)--compile (compilation)--Assembly (assembly)--Connect

File Suffix Name Description:
. C:c Language Code
. A: library file consisting of target files
. C,.cc,.cpp:c++ Code
. h: Header files included in the program
. I: Pre-preprocessed C source files, typically intermediate code files
. II: Pre-processed C + + source files
. O: Compiled target file, intermediate target file generated by source file
. S: source code for assembly language
. S: After compiling with compilation source code
. O: After compiling the program target file, the target file is connected to the execution file


GCC: Compiling the program
-O: Specifies the compiled output file (default output to the current folder a.out)
GCC A.c-o test.out
-V: View the program compilation process and display the library that has been called
Gcc-v A.C
-X: Specifies the compilation language (used in extensions not recognized by the compiler)
Gcc-x ' C ' a.u
-asci: Specifies that the compiler uses the Ansic standard
-E: Only pre-compilation (. cxx) is done
-S: only to generate assembly files (. S)
-C: Generate only directory code and do not generate executable program (. O)

-G: Use GDB debugger with-o output xxx.debug file

Compile Process Control:
-e-s-C
SOURCE Files---> Preprocessing files---> assembly files---> Target files---> executables

GDB: Debug Program
GDB: Start the debugging environment
File xxx.debug: Loading debug files
List N: Show 10 rows starting with N
Break N: Add a breakpoint on n rows
Info breakpoint [n]: View breakpoints set in program/view n breakpoints
Next: The program runs to the next line to stop
Continue: The program will run to the next breakpoint stop
Step: Run one line at a line (same as next), but step can go inside the calling function
Print: Output variable current value
Delete N: Remove n Breakpoints
Q: Exit the Environment

gcc compiler C language

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.