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


边栏推荐
- oracle cdc 但是使用的服务名没有sid 该怎么配置呢?
- Ten MySQL locks, one article will give you full analysis
- Redis持久化(少年一貫快馬揚帆,道阻且長不轉彎)
- Matlb| visual learning (plot and bar)
- "Jay bear" plummeted by 96.6%. Why is NFT with star goods cold?
- [translation] list of Clickhouse 22.4 and 22.5 core features
- Which securities company is better and safer to choose for opening an exchange fund account by mobile phone
- Xiaoxin black apple sound card ID injection
- Rsync remote synchronization (sunset is especially gentle, and the world is romantic)
- How to create a CSR (certificate signing request) file?
猜你喜欢

强化学习在黄页商家智能聊天助手中的探索实践

Batch modify specified character file name bat script

节点基础~节点层级

Q: how bad can a programmer be?

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

麻醉不止“打一针”那么简单,无痛、安全、舒适为患者首选

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

2022 review questions and answers for safety production management personnel of hazardous chemical production units

Redis persistence (young people always set sail with a fast horse, with obstacles and long turns)

Matlb| optimal operation and marketization of power system
随机推荐
Nuc980 heartbeat light
【译】clickhouse 22.4和22.5核心特性一览
C 语言进阶
Redis persistence (young people always set sail with a fast horse, with obstacles and long turns)
CSDN Blogger
[official cooperation between Shang Silicon Valley and Tencent cloud] video release of Silicon Valley classroom project
ZABBIX monitoring of traditional operation and maintenance (you get up early, I get up early, and we will get together sooner or later)
Redis主从复制、哨兵、cluster集群原理+实验(好好等,会晚些,但会更好)
[tcapulusdb] I wish you all a healthy Dragon Boat Festival!
How to make your WordPress website more secure
Node foundation ~ node level
Krack based network attack "suggestions collection"
Exploration and practice of reinforcement learning in yellow page merchants' intelligent chat assistant
Dpdk 20.11 compiling, installing and running program
How to back up a WordPress database
NoSQL之Redis配置与优化(你不在南京的日子我替你吹了秦淮河的晚风)
Metaq installation deployment document
IDC:阿里云获2021中国数据治理平台市场份额第一
Ask the bosses why the number type of Oracle CDC becomes a string when printed out. How can it be converted back?
June 27, 2022 to July 3, 2022 (UE4 video tutorial)