当前位置:网站首页>GCC getting started manual
GCC getting started manual
2022-06-28 18:06:00 【Kobayashi meow】
gcc Introduction
see GCC manual
GCC Read the manual online 
GCC Manual English pdf edition 
GCC Manual Chinese pdf edition 
C Chinese language network GCC brief introduction 
see gcc edition
#gcc -v

gcc Supported files

gcc The build process
The compilation process is not a one-step process , It is divided into precompiled 、 compile 、 assembly 、 link .
Preprocessing : Source file .c --> Processed source file .i
compile : Source file .i --> Assembly files .s
assembly : Assembly files .s --> Target file .o
link : Relocatable target file .o --> Executable target file (ELF)
But if directly gcc hello.c, will “ direct ” Generate an executable file a.out, In fact, the intermediate process still includes pretreatment 、 compile 、 assembly 、 Link four processes , It is only implemented internally .
Then why not directly generate the execution file ?
- GNU Thought : A tool can only do one thing
- Computer industry thinking : Standard interface + layered
- Simplify the work of the compiler 、 Improve the reusability of tools
- Adapt to more platforms 、CPU framework 、 Instruction set
gcc Common options for
#gcc --help
[email protected]-virtual-machine:/mnt/hgfs/share$ gcc --help
Usage: gcc [options] file...
Options:
-pass-exit-codes Exit with highest error code from a phase
--help Display this information
--target-help Display target specific command line options
--help={
common|optimizers|params|target|warnings|[^]{
joined|separate|undocumented}}[,...]
Display specific types of command line options
(Use '-v --help' to display command line options of sub-processes)
--version Display compiler version information
-dumpspecs Display all of the built in spec strings
-dumpversion Display the version of the compiler
-dumpmachine Display the compiler's target processor
-print-search-dirs Display the directories in the compiler's search path
-print-libgcc-file-name Display the name of the compiler's companion library
-print-file-name=<lib> Display the full path to library <lib>
-print-prog-name=<prog> Display the full path to compiler component <prog>
-print-multiarch Display the target's normalized GNU triplet, used as
a component in the library path
-print-multi-directory Display the root directory for versions of libgcc
-print-multi-lib Display the mapping between command line options and
multiple library search directories
-print-multi-os-directory Display the relative path to OS libraries
-print-sysroot Display the target libraries directory
-print-sysroot-headers-suffix Display the sysroot suffix used to find headers
-Wa,<options> Pass comma-separated <options> on to the assembler
-Wp,<options> Pass comma-separated <options> on to the preprocessor
-Wl,<options> Pass comma-separated <options> on to the linker
-Xassembler <arg> Pass <arg> on to the assembler
-Xpreprocessor <arg> Pass <arg> on to the preprocessor
-Xlinker <arg> Pass <arg> on to the linker
-save-temps Do not delete intermediate files
-save-temps=<arg> Do not delete intermediate files
-no-canonical-prefixes Do not canonicalize paths when building relative
prefixes to other gcc components
-pipe Use pipes rather than intermediate files
-time Time the execution of each subprocess
-specs=<file> Override built-in specs with the contents of <file>
-std=<standard> Assume that the input sources are for <standard>
--sysroot=<directory> Use <directory> as the root directory for headers
and libraries
-B <directory> Add <directory> to the compiler's search paths
-v Display the programs invoked by the compiler
-### Like -v but options quoted and commands not executed
-E Preprocess only; do not compile, assemble or link
-S Compile only; do not assemble or link
-c Compile and assemble, but do not link
-o <file> Place the output into <file>
-pie Create a position independent executable
-shared Create a shared library
-x <language> Specify the language of the following input files
Permissible languages include: c c++ assembler none
'none' means revert to the default behavior of
guessing the language based on the file's extension
Options starting with -g, -f, -m, -O, -W, or --param are automatically
passed on to the various sub-processes invoked by gcc. In order to pass
other options on to these processes the -W<letter> options must be used.
For bug reporting instructions, please see:
<file:///usr/share/doc/gcc-5/README.Bugs>.
It's convenient for you to check , Here is a translation version .
-pass-exit-codes The highest error code returned when exiting at a certain stage
--help Show this help description
--target-help Displays command line options specific to the target machine
--help={
target|optimizers|warnings|params|[^]{
joined|separate|
undocumented}}[,...] // Show specific types of command line options
( Use ‘-v --help’ Display the command line parameters of the child process )
--version Display compiler version information
-dumpspecs Show all built-in spec character string
-dumpversion Displays the version number of the compiler
-dumpmachine Displays the target processor of the compiler
-print-search-dirs Displays the compiler's search path
-print-libgcc-file-name Displays the name of the compiler Companion Library
-print-file-name=< library > Show < library > Full path to
-print-prog-name=< Program > Show compiler components < Program > Full path to
-print-multi-directory Show different versions libgcc Root directory
-print-multi-lib Displays the mapping between command line options and multiple version library search paths
-print-multi-os-directory Displays the relative path of the operating system library
-print-sysroot Displays the target library directory
-print-sysroot-headers-suffix Displays the... Used to find header files sysroot suffix
-Wa,< Options > Comma separated < Options > Pass it to the assembler
-Wp,< Options > Comma separated < Options > Pass to preprocessor
-Wl,< Options > Comma separated < Options > Pass it to the linker
-Xassembler < Parameters > take < Parameters > Pass it to the assembler
-Xpreprocessor < Parameters > take < Parameters > Pass to preprocessor
-Xlinker < Parameters > take < Parameters > Pass it to the linker
-combine Passing multiple source files to the assembler at one time
-save-temps Do not delete intermediate files
-save-temps=<arg> Do not delete intermediate files
-no-canonical-prefixes Generate other gcc Relative paths of components do not generate normalized
Prefix
-pipe Use pipes instead of temporary files
-time Time each child process
-specs=< file > use < file > The content of covers the built-in specs file
-std=< standard > Specify the standard that the input source file follows
--sysroot=< Catalog > take < Catalog > As the root directory of header files and library files
-B < Catalog > take < Catalog > Add to the compiler's search path
-b < machine > by gcc Specify the target machine ( If installed )
-V < edition > Run the specified version of gcc( If installed )
-v Shows the program that the compiler calls
-### And -v similar , But the options are in quotation marks , And don't execute orders
-E Pretreatment only , No compilation 、 Compilations and links
-S Compile to assembly language , No assembly and linking
-c compile 、 Assemble to object code , Don't link
-o < file > Output to < file >
-x < Language > Specifies the language of the subsequent input file , The languages allowed include :c c++
assembler none‘none’ It means restoring the default behavior , That is, guess the language of the source file according to the file extension
said
With -g、-f、-m、-O、-W or --param The first option will be g++/gcc Automatically passed to its call
Different sub processes . To pass additional options to these processes , You have to use -W< Letter > Options .
adopt gcc --help You can see gcc The option to , The subject is case sensitive . But in fact, there are more than ten options commonly used .


边栏推荐
- A few lines of code can realize complex excel import and export. This tool class is really powerful!
- Anesthesia is not as simple as "one injection". Painless, safe and comfortable anesthesia is the first choice for patients
- C 语言进阶
- 2022危险化学品生产单位安全生产管理人员复习题及答案
- 麻醉不止“打一针”那么简单,无痛、安全、舒适为患者首选
- MySQL High available MHA (accidentellement avec ma jeunesse)
- [official cooperation between Shang Silicon Valley and Tencent cloud] video release of Silicon Valley classroom project
- Is the account opening link given by CICC securities manager safe? Who can I open an account with?
- TDengine&nbsp;×英特尔 边缘洞见软件包 加速传统行业的数字化转型
- Kubeadm create kubernetes cluster
猜你喜欢

Google推出Advanced API Security 保护API免受安全威胁

WPF video hard decoding, rendering and playing (no airspace) (support 4K, 8K and high frame rate video)

Flutter tips: mediaquery and build optimization secrets you don't know

IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021

Database mysql statement final review CTGU

Kubeadm create kubernetes cluster

Large scale sports events and crime risks

数据库MySQL语句期末复习 CTGU

使用Pega进行一个简单的RPA程序开发

节点基础~节点层级
随机推荐
C 语言进阶
数据库MySQL语句期末复习 CTGU
Redis主从复制、哨兵、cluster集群原理+实验(好好等,会晚些,但会更好)
使用Pega进行一个简单的RPA程序开发
JQ plug-in analysis
NoSQL之Redis配置与优化(你不在南京的日子我替你吹了秦淮河的晚风)
From getting started to mastering the application of | yalmip+cplex in power system (excellent, I will lose if I can't understand it, and I will lose if I don't gain)
Introduction to kubernetes resource object and common commands
Rsync remote synchronization (sunset is especially gentle, and the world is romantic)
Dpdk 20.11 compiling, installing and running program
How to configure the Oracle CDC service name without Sid?
Squid proxy server application (I came from afar to make an appointment with you)
2022年化工自动化控制仪表考试模拟100题模拟考试平台操作
居家高效远程办公 | 社区征文
Currency circle earthquake: earned 1million last year and lost 5million this year
kubernetes可视化界面dashboard
dataworks SQL脚本支持语句块的if else 判断吗
WPF video hard decoding, rendering and playing (no airspace) (support 4K, 8K and high frame rate video)
How to do a good job of gateway high availability protection in the big promotion scenario
Nuc980 heartbeat light