GCC - gcc - g++ 的区别
GCC - GNU Compiler Collection - GNU 编译器套件
gcc - GNU C Compiler
g++ - GNU C++ Compiler
GNAT - GNU Ada compiler
18.04 LTS man gcc
16.04 LTS man g++
1. Description
gcc
- GNU project C and C++ compiler
yongqiang@deepnorth-amax:~$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
yongqiang@deepnorth-amax:~$
yongqiang@deepnorth-amax:~$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
yongqiang@deepnorth-amax:~$
g++
accepts mostly the same options as gcc
.
g++
几乎接受与 gcc
相同的选项。
yongqiang@deepnorth-amax:~$ which gcc
/usr/bin/gcc
yongqiang@deepnorth-amax:~$
yongqiang@deepnorth-amax:~$ which g++
/usr/bin/g++
yongqiang@deepnorth-amax:~$
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking.
调用 GCC 时,通常会进行预处理、编译、汇编和链接。
yongqiang@deepnorth-amax:~$ ll /usr/bin/gcc
lrwxrwxrwx 1 root root 5 7月 8 2019 /usr/bin/gcc -> gcc-5*
yongqiang@deepnorth-amax:~$
yongqiang@deepnorth-amax:~$ ll /usr/bin/g++
lrwxrwxrwx 1 root root 5 7月 8 2019 /usr/bin/g++ -> g++-5*
yongqiang@deepnorth-amax:~$
yongqiang@deepnorth-amax:~$ ll /usr/bin/gcc*
lrwxrwxrwx 1 root root 5 7月 8 2019 /usr/bin/gcc -> gcc-5*
-rwxr-xr-x 1 root root 915736 8月 28 2018 /usr/bin/gcc-5*
lrwxrwxrwx 1 root root 8 7月 8 2019 /usr/bin/gcc-ar -> gcc-ar-5*
-rwxr-xr-x 1 root root 31136 8月 28 2018 /usr/bin/gcc-ar-5*
lrwxrwxrwx 1 root root 8 7月 8 2019 /usr/bin/gcc-nm -> gcc-nm-5*
-rwxr-xr-x 1 root root 31136 8月 28 2018 /usr/bin/gcc-nm-5*
lrwxrwxrwx 1 root root 12 7月 8 2019 /usr/bin/gcc-ranlib -> gcc-ranlib-5*
-rwxr-xr-x 1 root root 31136 8月 28 2018 /usr/bin/gcc-ranlib-5*
yongqiang@deepnorth-amax:~$
yongqiang@deepnorth-amax:~$ ll /usr/bin/g++*
lrwxrwxrwx 1 root root 5 7月 8 2019 /usr/bin/g++ -> g++-5*
-rwxr-xr-x 1 root root 919832 8月 28 2018 /usr/bin/g++-5*
yongqiang@deepnorth-amax:~$
yongqiang@deepnorth-amax:~$ g++ --version | head -n1
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
yongqiang@deepnorth-amax:~$
yongqiang@deepnorth-amax:~$ gcc --version | head -n1
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
yongqiang@deepnorth-amax:~$
Most of the command-line options that you can use with GCC are useful for C programs; when an option is only useful with another language (usually C++), the explanation says so explicitly. If the description for a particular option does not mention a source language, you can use that option with all supported languages.
您可以与 GCC 一起使用的大多数命令行选项对于 C 程序都是有用的。当一个选项仅对另一种语言 (通常是 C++) 有用时,会明确地说明。如果特定选项的描述未提及源语言,则可以将该选项与所有受支持的语言一起使用。
The usual way to run GCC is to run the executable called gcc
, or machine-gcc
when cross-compiling, or machine-gcc-version
to run a specific version of GCC. When you compile C++ programs, you should invoke GCC as g++
instead.
运行 GCC 的通常方法是运行名为 gcc
的可执行文件,或者在交叉编译时运行 machine-gcc
,或者运行特定版本的 GCC 的 machine-gcc-version
。编译 C++ 程序时,应改为将 GCC 作为 g++
调用。
The gcc
program accepts options and file names as operands. Many options have multi-letter names; therefore multiple single-letter options may not be grouped: -dv
is very different from -d -v
.
gcc
程序接受选项和文件名作为操作数。许多选项具有多字母名称。因此,多个单字母选项可能不会分组:-dv
与 -d -v
有很大不同。
-v
Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper.
打印 (在标准错误输出上) 用于运行编译阶段的命令。还要打印编译器驱动程序的版本号以及预处理器和适当的编译器的版本号。
yongqiang@deepnorth-amax:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
yongqiang@deepnorth-amax:~$
yongqiang@deepnorth-amax:~$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
yongqiang@deepnorth-amax:~$
2. Compiling C++ Programs
C++ source files conventionally use one of the suffixes .C
, .cc
, .cpp
, .CPP
, .c++
, .cp
, or .cxx
; C++ header files often use .hh
, .hpp
, .H
, or (for shared template code) .tcc
; and preprocessed C++ files use the suffix .ii
. GCC recognizes files with these names and compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the name gcc
).
C++ 源文件通常使用后缀 .C
, .cc
, .cpp
, .CPP
, .c++
, .cp
, or .cxx
之一。C++ 头文件通常使用 .hh
, .hpp
, .H
或 (对于共享模板代码) .tcc
,预处理的 C++ 文件使用后缀 .ii
。即使您以与编译 C 程序相同的方式调用编译器 (通常使用 gcc
名称),GCC 也会识别具有这些名称的文件并将其编译为 C++ 程序。
However, the use of gcc
does not add the C++ library. g++
is a program that calls GCC and automatically specifies linking against the C++ library. It treats .c
, .h
and .i
files as C++ source files instead of C source files unless -x
is used. This program is also useful when precompiling a C header file with a .h
extension for use in C++ compilations. On many systems, g++
is also installed with the name c++
.
但是,使用 gcc 不会添加 C++ 库。g++
是一个调用 GCC 并自动指定针对 C++ 库的链接的程序。除非使用 -x
,否则它将 .c
, .h
and .i
文件视为 C++ 源文件而不是 C 源文件。当预编译带有 .h
扩展名的 C 头文件以用于 C++ 编译时,该程序也很有用。在许多系统上,还安装了名称为 c++
的 g++
。
When you compile C++ programs, you may specify many of the same command-line options that you use for compiling programs in any language; or command-line options meaningful for C and related languages; or options that are meaningful only for C++ programs.
编译 C++ 程序时,可以指定用于以任何语言编译程序的许多相同的命令行选项。或对 C 和相关语言有意义的命令行选项,或仅对 C++ 程序有意义的选项。
See Options Controlling C Dialect, for explanations of options for languages related to C. See Options Controlling C++ Dialect, for explanations of options that are meaningful only for C++ programs.
3.4 Options Controlling C Dialect
https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
3.5 Options Controlling C++ Dialect
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html
dialect ['daɪəlekt]:n. 方言,地方话,土话
3. Programming Languages Supported by GCC
GCC stands for GNU Compiler Collection. GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C++, Objective-C, Objective-C++, Java, Fortran, Ada, and Go.
GCC stands for GNU Compiler Collection. GCC 是几种主要编程语言的编译器的集成发行版。这些语言当前包括 C, C++, Objective-C, Objective-C++, Java, Fortran, Ada, and Go。
The abbreviation GCC has multiple meanings in common use. The current official meaning is GNU Compiler Collection, which refers generically to the complete suite of tools. The name historically stood for GNU C Compiler, and this usage is still common when the emphasis is on compiling C programs. Finally, the name is also used when speaking of the language-independent component of GCC: code shared among the compilers for all supported languages.
缩写 GCC 具有常用的多种含义。当前的正式含义是 GNU Compiler Collection,该集合一般指完整的工具套件。这个名称在历史上代表 GNU C Compiler,当重点放在编译 C 程序时,这种用法仍然很常见。最后,在谈到 GCC 的独立于语言的组件时,也使用该名称:所有支持的语言在编译器之间共享的代码。
The language-independent component of GCC includes the majority of the optimizers, as well as the “back ends” that generate machine code for various processors.
GCC 的独立于语言的组件包括大多数优化器,以及为各种处理器生成机器代码的后端。
The part of a compiler that is specific to a particular language is called the “front end”. In addition to the front ends that are integrated components of GCC, there are several other front ends that are maintained separately. These support languages such as Pascal, Mercury, and COBOL. To use these, they must be built together with GCC proper.
特定于特定语言的编译器部分称为前端。除了作为 GCC 集成组件的前端外,还有一些其他前端需要单独维护。这些支持语言,例如 Pascal, Mercury, and COBOL。要使用它们,必须将它们与 GCC 适当地一起构建。
Most of the compilers for languages other than C have their own names. The C++ compiler is G++, the Ada compiler is GNAT, and so on. When we talk about compiling one of those languages, we might refer to that compiler by its own name, or as GCC. Either is correct.
除 C 之外的大多数语言的编译器都有自己的名称。C++ 编译器是 G++,Ada 编译器是 GNAT,依此类推。当我们谈论编译这些语言中的一种时,我们可能会使用自己的名称或 GCC 来引用该编译器。两者都是正确的。
Historically, compilers for many languages, including C++ and Fortran, have been implemented as “preprocessors” which emit another high level language such as C. None of the compilers included in GCC are implemented this way; they all generate machine code directly. This sort of preprocessor should not be confused with the C preprocessor, which is an integral feature of the C, C++, Objective-C and Objective-C++ languages.
从历史上看,用于多种语言 (包括 C++ 和 Fortran) 的编译器已实现为预处理器,发出了诸如 C 之类的另一种高级语言。它们都直接生成机器代码。此类预处理器不应与 C 预处理器混淆,C 预处理器是 C, C++, Objective-C and Objective-C++ 语言的不可或缺的功能。
4. difference
g++
会自动链接 C++ 标准库。gcc
可以编译 C++ 文件,只是gcc
不能自动联接 C++ 程序使用的库,链接过程不能使用gcc
,通常用g++
来完成链接。编译阶段,g++
会调用gcc
。(However, the use ofgcc
does not add the C++ library.g++
is a program that calls GCC and automatically specifies linking against the C++ library.)gcc
会根据文件后缀自动识别是 C 文件还是 C++ 文件,g++
均认为是 C++ 文件。(GCC recognizes files with these names and compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the namegcc
).)gcc
编译 C 文件少一些宏定义,gcc
编译 C++ 多一些宏定义。- 从本质上说,
gcc
和g++
并不是编译器,也不是编译器的集合,它们只是一种驱动器,根据参数中要编译的文件的类型,调用对应的 GUN 编译器而已。命令行下输入gcc
或g++
,背后都是运行 GCC 编译器对源代码进行编译和各种处理,两个命令其实是一样的,只是对 GCC 编译器的默认配置选项不同。gcc
andg++
are compiler-drivers of the GNU Compiler Collection (which was once upon a time just the GNU C Compiler). - The probably most important difference in their defaults is which libraries they link against automatically.
g++
is equivalent togcc -xc++ -lstdc++ -shared-libgcc
(the 1st is a compiler option, the 2nd two are linker options).gcc
调用了 C compiler,而g++
调用了 C++ compiler。When theg++
program is used to link a C++ program, it normally automatically links againstlibstdc++
.
5. hello_world.c
/*
============================================================================
Name : hello_world.c
Author : Yongqiang Cheng
Version : Version 1.0.0
Copyright : Copyright (c) 2019 Yongqiang Cheng
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
return EXIT_SUCCESS;
}
strong@foreverstrong:~/Desktop/makefile_work$ pwd
/home/strong/Desktop/makefile_work
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ll
total 12
drwxrwxr-x 2 strong strong 4096 Feb 6 10:10 ./
drwxr-xr-x 11 strong strong 4096 Feb 4 18:56 ../
-rw-rw-r-- 1 strong strong 491 Feb 6 10:10 hello_world.c
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ gcc hello_world.c
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ls -l
total 16
-rwxrwxr-x 1 strong strong 8608 Feb 6 10:11 a.out
-rw-rw-r-- 1 strong strong 491 Feb 6 10:10 hello_world.c
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ./a.out
!!!Hello World!!!
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ rm -rf a.out
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ll
total 12
drwxrwxr-x 2 strong strong 4096 Feb 6 10:12 ./
drwxr-xr-x 11 strong strong 4096 Feb 4 18:56 ../
-rw-rw-r-- 1 strong strong 491 Feb 6 10:10 hello_world.c
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ g++ hello_world.c
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ls -l
total 16
-rwxrwxr-x 1 strong strong 8608 Feb 6 10:12 a.out
-rw-rw-r-- 1 strong strong 491 Feb 6 10:10 hello_world.c
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ./a.out
!!!Hello World!!!
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ rm -rf a.out
strong@foreverstrong:~/Desktop/makefile_work$
6. hello_world.cpp
//============================================================================
// Name : hello_world.cpp
// Author : Yongqiang Cheng
// Version : Version 1.0.0
// Copyright : Copyright (c) 2019 Yongqiang Cheng
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
int main()
{
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}
strong@foreverstrong:~/Desktop/makefile_work$ pwd
/home/strong/Desktop/makefile_work
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ll
total 12
drwxrwxr-x 2 strong strong 4096 Feb 6 11:58 ./
drwxr-xr-x 11 strong strong 4096 Feb 4 18:56 ../
-rw-rw-r-- 1 strong strong 491 Feb 6 10:18 hello_world.cpp
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ gcc hello_world.cpp
/tmp/ccLTtpnZ.o: In function `main':
hello_world.cpp:(.text+0xa): undefined reference to `std::cout'
hello_world.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
hello_world.cpp:(.text+0x14): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
hello_world.cpp:(.text+0x1c): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/tmp/ccLTtpnZ.o: In function `__static_initialization_and_destruction_0(int, int)':
hello_world.cpp:(.text+0x4a): undefined reference to `std::ios_base::Init::Init()'
hello_world.cpp:(.text+0x59): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ gcc -lstdc++ hello_world.cpp
/tmp/cc23qhmb.o: In function `main':
hello_world.cpp:(.text+0xa): undefined reference to `std::cout'
hello_world.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
hello_world.cpp:(.text+0x14): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
hello_world.cpp:(.text+0x1c): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/tmp/cc23qhmb.o: In function `__static_initialization_and_destruction_0(int, int)':
hello_world.cpp:(.text+0x4a): undefined reference to `std::ios_base::Init::Init()'
hello_world.cpp:(.text+0x59): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ gcc hello_world.cpp -lstdc++
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ls -l
total 16
-rwxrwxr-x 1 strong strong 9224 Feb 6 12:00 a.out
-rw-rw-r-- 1 strong strong 491 Feb 6 10:18 hello_world.cpp
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ./a.out
!!!Hello World!!!
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ rm -rf a.out
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ll
total 12
drwxrwxr-x 2 strong strong 4096 Feb 6 12:01 ./
drwxr-xr-x 11 strong strong 4096 Feb 4 18:56 ../
-rw-rw-r-- 1 strong strong 491 Feb 6 10:18 hello_world.cpp
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ g++ hello_world.cpp
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ls -l
total 16
-rwxrwxr-x 1 strong strong 9224 Feb 6 12:01 a.out
-rw-rw-r-- 1 strong strong 491 Feb 6 10:18 hello_world.cpp
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ ./a.out
!!!Hello World!!!
strong@foreverstrong:~/Desktop/makefile_work$
strong@foreverstrong:~/Desktop/makefile_work$ rm -rf a.out
strong@foreverstrong:~/Desktop/makefile_work$
7. gcc
- g++
(base) yongqiang@famu-sys:~$ conda deactivate
yongqiang@famu-sys:~$
yongqiang@famu-sys:~$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/share/man/man1/gcc.1.gz
yongqiang@famu-sys:~$
yongqiang@famu-sys:~$ whereis g++
g++: /usr/bin/g++ /usr/share/man/man1/g++.1.gz
yongqiang@famu-sys:~$
yongqiang@famu-sys:~$ which gcc
/usr/bin/gcc
yongqiang@famu-sys:~$
yongqiang@famu-sys:~$ which g++
/usr/bin/g++
yongqiang@famu-sys:~$
References
https://manpages.ubuntu.com/manpages/bionic/en/man1/gcc.1.html
http://manpages.ubuntu.com/manpages/xenial/en/man1/g++.1.html
Using the GNU Compiler Collection (GCC)
https://gcc.gnu.org/onlinedocs/gcc/index.html
3.3 Compiling C++ Programs
https://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html#Invoking-G_002b_002b