gcc编绎器命令示例

GCC stands for "GNU Compiler Collection", support C,C++,Objective-C,
Objective-C++,Java,Fortran, and Ada.

Languages Standards Supported by GCC
1.C language: 
a.C89(or ocasionally as C90),To select this standard in GCC,
use one of the options '-ansi','-std=c90',or '-std=iso9899:1990',to obtian all the diagnostic required by the standard, you should also specify '-pedantic', if you want them to be errors rather than warnings.
b.C99: '-std=c99'
2. GCC supports the ISO C++ standard (1998) and contains experimental support for the upcoming ISO C++ standard(200x).
Option Summary
Here is a summary of all the options, grouped by type. Explanations are in the following
sections.

Overall Options
See Section 3.2 [Options Controlling the Kind of Output], page 22.

-c -S -E -o file -combine -no-canonical-prefixes
-pipe -pass-exit-codes
-x language -v -### --help[=class[,...]] --target-help
--version -wrapper@file -fplugin=file -fplugin-arg-name=arg

C Language Options
See Section 3.4 [Options Controlling C Dialect], page 28.

-ansi -std=standard -fgnu89-inline
-aux-info filename
-fno-asm -fno-builtin -fno-builtin-function
-fhosted -ffreestanding -fopenmp -fms-extensions
-trigraphs -no-integrated-cpp -traditional -traditional-cpp
-fallow-single-precision -fcond-mismatch -flax-vector-conversions
-fsigned-bitfields -fsigned-char
-funsigned-bitfields -funsigned-char

C++ Language Options
See Section 3.5 [Options Controlling C++ Dialect], page 33.

-fabi-version=n -fno-access-control -fcheck-new
-fconserve-space -ffriend-injection
-fno-elide-constructors
-fno-enforce-eh-specs
-ffor-scope -fno-for-scope -fno-gnu-keywords
-fno-implicit-templates
-fno-implicit-inline-templates
-fno-implement-inlines -fms-extensions
-fno-nonansi-builtins -fno-operator-names
-fno-optional-diags -fpermissive
-fno-pretty-templates
-frepo -fno-rtti -fstats -ftemplate-depth=n
-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++
-fno-default-inline -fvisibility-inlines-hidden
-fvisibility-ms-compat
-Wabi -Wconversion-null -Wctor-dtor-privacy
-Wnon-virtual-dtor -Wreorder
-Weffc++ -Wstrict-null-sentinel
-Wno-non-template-friend -Wold-style-cast
-Woverloaded-virtual -Wno-pmf-conversions
-Wsign-promo

Compilation can involve up to four stages: preprocessing, compilation proper, assembly and linking, always in that order.

example:
g++ hello.cpp -o hello2.exe
gcc hello.c -o hello


原文地址:https://www.cnblogs.com/wucg/p/2091718.html