GCC简介
GCC 是 GNU 编译器集合的意思(GNU Compiler Collection), 它可以编译C、C++、JAV、Fortran、Pascal、Object-C、Ada等语言。
gcc是GCC中的GUN C Compiler(C 编译器)
g++是GCC中的GUN C++ Compiler(C++编译器)
就本质而言,gcc和g++并不是编译器,也不是编译器的集合,它们只是一种驱动器,根据参数中要编译的文件的类型,调用对应的GUN编译器而已,比如,用gcc编译一个c文件的话,会有以下几个步骤:
Step1:Call a preprocessor, like cpp.
Step2:Call an actual compiler, like cc or cc1.
Step3:Call an assembler, like as.
Step4:Call a linker, like ld
由于编译器是可以更换的,所以gcc不仅仅可以编译C文件。 所以,更准确的说法是:gcc调用了C compiler,而g++调用了C++ compiler
具体而言
g++ 会把 .c 文件当做是 C++ 语言 (在 .c 文件前后分别加上 -xc++ 和 -xnone, 强行变成 C++), 从而调用 cc1plus 进行编译.
g++ 遇到 .cpp 文件也会当做是 C++, 调用 cc1plus 进行编译.
g++ 还会默认告诉链接器, 让它链接上 C++ 标准库. gcc 会把 .c 文件当做是 C 语言. 从而调用 cc1 进行编译.
gcc 遇到 .cpp 文件, 会处理成 C++ 语言. 调用 cc1plus 进行编译. gcc 默认不会链接上 C++ 标准库.
CentOS 镜像资源
http://debuginfo.centos.org/7/aarch64/
https://centos.pkgs.org/7/centos-x86_64/
1 在ISO光盘中Package目录下有很多rpm安装包,主要包括两种
一种库文件安装包,一种开发安装包devel
[root@localhost Packages]# rpm -ivh glibc-2.12-1.132.el6.x86_64.rpm
warning: glibc-2.12-1.132.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
package glibc-2.12-1.132.el6.x86_64 is already installed
[root@localhost Packages]# rpm -ivh glibc-devel-2.12-1.132.el6.x86_64.rpm
warning: glibc-devel-2.12-1.132.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
glibc-headers is needed by glibc-devel-2.12-1.132.el6.x86_64
glibc-headers = 2.12-1.132.el6 is needed by glibc-devel-2.12-1.132.el6.x86_64
[root@localhost Packages]# rpm -ivh glibc-headers-2.12-1.132.el6.x86_64.rpm
warning: glibc-headers-2.12-1.132.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
kernel-headers is needed by glibc-headers-2.12-1.132.el6.x86_64
kernel-headers >= 2.2.1 is needed by glibc-headers-2.12-1.132.el6.x86_64
第一个kernel-headers-2.6.32-431.el6.x86_64.rpm
第二个glibc-headers-2.12-1.132.el6.x86_64.rpm
第三个glibc-devel-2.12-1.132.el6.x86_64.rpm
第四个mpfr-2.4.1-6.el6.x86_64.rpm
第五个cpp-4.4.7-4.el6.x86_64.rpm
第六个ppl-0.10.2-11.el6.x86_64.rpm
补充:
libppl.so.7()(64bit) is needed by cloog-ppl-0.15.7-1.2.el6.x86_64
libppl_c.so.2()(64bit) is needed by cloog-ppl-0.15.7-1.2.el6.x86_64
第七个cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
第八个libgomp-4.4.7-4.el6.x86_64.rpm
补充:
libgomp = 4.4.7-4.el6 is needed by gcc-4.4.7-4.el6.x86_64
libgomp.so.1()(64bit) is needed by gcc-4.4.7-4.el6.x86_64
第九个gcc-4.4.7-4.el6.x86_64.rpm
补充:
error: Failed dependencies:
cloog-ppl >= 0.15 is needed by gcc-4.4.7-4.el6.x86_64
cpp = 4.4.7-4.el6 is needed by gcc-4.4.7-4.el6.x86_64
libgomp = 4.4.7-4.el6 is needed by gcc-4.4.7-4.el6.x86_64
libgomp.so.1()(64bit) is needed by gcc-4.4.7-4.el6.x86_64
第10个libstdc++-devel-4.4.7-4.el6.x86_64.rpm
第11个libstdc++-docs-4.4.7-4.el6.x86_64.rpm
第12个libsigc++20-2.2.4.2-1.el6.x86_64.rpm
第13个gcc-c++-4.4.7-4.el6.x86_64.rpm
第14个gdb-7.2-60.el6_4.1.x86_64.rpm