GCC common commands

Source: Internet
Author: User
Author: wstruecolor
Gcc is a common compilation tool developed in unix. I know little about gcc,
Gcc-o xx. cpp
Today, I reviewed the gnu gcc manual and took some time to summarize it,
Share with you! Hope to help you.
Here we will introduce the common Command Options of gcc (refer to gnu gcc manual ).
1. languages supported by gcc.
GCC stands for GNU Compiler Collection, which includes the compilation of major compilers in C, C ++, Objective-C, Java, Fortran, and Ada languages.
2. gcc Command Options
When gcc is executed, it usually goes through four processing processes: preprocessing, compilation, assembly and linking. You can abort a process by adding different options.

A. Total options.
-C-S-E-o file-pipe-pass-exit-codes
-X language-v-### -- help -- target-help -- version
The compiler compiles the file in four stages. As mentioned above, the file is compiled in order.
The compiler determines the Stage of Processing Based on the suffix of the input file:
The file. c file must be prefixed.
The file. I c source file does not need to be prefixed.
The file. ii c ++ source file does not need to be prefixed.
File. h c/c ++ compile the header file.
File. cc
File. cp
File. cxx
File. cpp
File. CPP
File. c ++
The file. C c ++ source file must be prefixed.
File. hh
The file. H c ++ header file is converted into a prefix header file.

File. s
Assembler code.

File. S
Cycler code which must be preprocessed

-X language ========== the option is to specify a language to tell the gcc file what language it is,
It is unnecessary to identify the default suffix.
Languge can be:
C-header cpp-output
C ++-header c ++-cpp-output
Objective-c-header objc-cpp-output
Extends er extends er-with-cpp
Ada
F77 f77-cpp-input ratfor
Java
Treelang

-X none uses suffix recognition to disable language recognition.

-C is only compiled and not connected, and all generated are target files. c,. I,. s =>. o

-S only compiles without assembly and generates assembly code... c,. I =>. s

-E is just for prefix compilation, but not for other processing.
-O file: output the output file to the file.

-V prints the command line information of each process internally compiled by the compiler and the version of the compiler.
-### Same as above, but the command is not actually executed.
-The pipe compiler saves the information of each stage to a temporary file during compilation. If you do not want
If a temporary file is used, you can use the MPs queue as well. This command option is used, but some systems do not support it.

Editor's note: No dual netizen supplements
Other options such as-On (n =, 3)-arch = pentium4 are used for optimization.
-G for debugging
Also supported by prof, you can determine the program running efficiency.

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.