当前位置:网站首页>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 .


边栏推荐
- The most complete 360 software test case template without dead corners in the whole network [recommended collection]
- Rsync remote synchronization (sunset is especially gentle, and the world is romantic)
- Redis主从复制、哨兵、cluster集群原理+实验(好好等,会晚些,但会更好)
- ZABBIX monitoring of traditional operation and maintenance (you get up early, I get up early, and we will get together sooner or later)
- How to do a good job of gateway high availability protection in the big promotion scenario
- Panorama of enterprise power in China SSD industry
- win10用cmake3.22与vs2019编译curl库源码并调用
- 6 - Dictionary
- Ding! Techo day Tencent technology open day arrived as scheduled!
- Spruce network deepflow helps 5g core network and telecom cloud build observability
猜你喜欢

Leetcode 6. Zigzag transformation (awesome, solved)

2022年山东省安全员C证考试练习题及模拟考试
![[algorithm] I brushed two big factory interview questions and learned array again with tears in my eyes“](/img/ab/69c79690bf42c58c39b2e85fb3690c.png)
[algorithm] I brushed two big factory interview questions and learned array again with tears in my eyes“

此虚拟机的处理器所支持的功能不同于保存虚拟机状态的虚拟机的处理器所支持的功能

Time effective simulation platform based on dataworks | acquisition technology
![抓包整理外篇fiddler————了解工具栏[一]](/img/f4/fa909f30c0097fb77cea10eb0d3109.png)
抓包整理外篇fiddler————了解工具栏[一]

Redis持久化(少年一貫快馬揚帆,道阻且長不轉彎)

2022 recurrent training question bank and online simulation examination for main principals of hazardous chemicals business units
![Halcon knowledge: matrix topic [01]](/img/d3/2726da70c41c7adccc3474be6f51c8.png)
Halcon knowledge: matrix topic [01]

2022a special equipment related management (elevator) special operation certificate examination question bank and online simulation examination
随机推荐
How to put your WordPress website in maintenance mode
The fourth largest operator cannot be a "catfish"
How to configure the Oracle CDC service name without Sid?
Can tongdaxin open an account for stock trading? Is it safe?
Stackoverflow 2022 developer report: PostgreSQL surpasses MySQL!
DMS的SQL结果集导出支持传参数吗?
强化学习在黄页商家智能聊天助手中的探索实践
Ding! Techo day Tencent technology open day arrived as scheduled!
Database mysql statement final review CTGU
11 effective ways to enhance WordPress
kubernetes资源对象介绍及常用命令
A few lines of code can realize complex excel import and export. This tool class is really powerful!
为什么 insert 配置 'SELECT LAST_INSERT_ID()' 返回个0呢?
Is the account opening link given by CICC securities manager safe? Who can I open an account with?
Advanced C language
Apache setting timeout parameter
Matlb| visual learning (plot and bar)
使用Pega进行一个简单的RPA程序开发
Redis 原理 - Hash
Currency circle earthquake: earned 1million last year and lost 5million this year