Linux/Centos:如何安装GCC(C和C++编译器)

时间:2022-10-11 02:05:11

linux系统下或者Centos7/Red Hat7企业版系统里如何安装gnu下的GCC编译器以及相关的工具呢?(autoconf,automake,flex,c++ compiler)

你需要安装包含下面的软件包的基本开发工具环境,那么就会自动安装好我们想要装gcc编译器:

  1.     autoconf
  2.   automake
  3.   binutils
  4.     bison
  5.     flex
  6.     gcc
  7.     gcc-c++
  8.     gettext
  9.     libtool
  10.     make
  11.     patch
  12.     pkgconfig
  13.     redhat-rpm-config
  14.     rpm-build
  15.     rpm-sign

输入下面的命令安装基本工具开发包:

1
# yum group install “Development Tools "

下一步可以用whereis gcc这个命令来验证是否安装成功:

1
2
3
[root @devops ~ ] # whereis gcc
gcc: /usr /bin / gcc /usr /lib / gcc /usr /libexec / gcc /usr /share /man /man1 /gcc.1.gz
[root @devops ~ ] #

或者通过gcc家–version选项来查看gcc的版本号:

1
2
3
4
5
[root@devops ~]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.8.2-16)
Copyright (C) 2010 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.