How To Install gcc-c++ on CentOS 8

gcc-c++ is C++ support for GCC

Introduction

In this tutorial we learn how to install gcc-c++ on CentOS 8.

What is gcc-c++

This package adds C++ support to the GNU Compiler Collection. It includes support for most of the current C++ specification, including templates and exception handling.

We can use yum or dnf to install gcc-c++ on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install gcc-c++.

Install gcc-c++ on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install gcc-c++ using dnf by running the following command:

sudo dnf -y install gcc-c++

Install gcc-c++ on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install gcc-c++ using yum by running the following command:

sudo yum -y install gcc-c++

How To Uninstall gcc-c++ on CentOS 8

To uninstall only the gcc-c++ package we can use the following command:

sudo dnf remove gcc-c++

gcc-c++ Package Contents on CentOS 8

/usr/bin/c++
/usr/bin/g++
/usr/bin/x86_64-redhat-linux-c++
/usr/bin/x86_64-redhat-linux-g++
/usr/lib/.build-id
/usr/lib/.build-id/07
/usr/lib/.build-id/07/a102f55f86a1afc5a5d69163a144a180c7d628
/usr/lib/.build-id/95
/usr/lib/.build-id/95/1e7a996ef4b4c8d995d1afd33c35750973a042
/usr/lib/.build-id/95/1e7a996ef4b4c8d995d1afd33c35750973a042.1
/usr/lib/.build-id/95/1e7a996ef4b4c8d995d1afd33c35750973a042.2
/usr/lib/.build-id/95/1e7a996ef4b4c8d995d1afd33c35750973a042.3
/usr/lib/gcc
/usr/lib/gcc/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/8
/usr/lib/gcc/x86_64-redhat-linux/8/32
/usr/lib/gcc/x86_64-redhat-linux/8/32/libstdc++.a
/usr/lib/gcc/x86_64-redhat-linux/8/32/libstdc++.so
/usr/lib/gcc/x86_64-redhat-linux/8/32/libstdc++fs.a
/usr/lib/gcc/x86_64-redhat-linux/8/32/libsupc++.a
/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so
/usr/libexec/gcc
/usr/libexec/gcc/x86_64-redhat-linux
/usr/libexec/gcc/x86_64-redhat-linux/8
/usr/libexec/gcc/x86_64-redhat-linux/8/cc1plus
/usr/share/doc/gcc-c++
/usr/share/doc/gcc-c++/ChangeLog-1993.bz2
/usr/share/doc/gcc-c++/ChangeLog-1994.bz2
/usr/share/doc/gcc-c++/ChangeLog-1995.bz2
/usr/share/doc/gcc-c++/ChangeLog-1996.bz2
/usr/share/doc/gcc-c++/ChangeLog-1997.bz2
/usr/share/doc/gcc-c++/ChangeLog-1998.bz2
/usr/share/doc/gcc-c++/ChangeLog-1999.bz2
/usr/share/doc/gcc-c++/ChangeLog-2000.bz2
/usr/share/doc/gcc-c++/ChangeLog-2001.bz2
/usr/share/doc/gcc-c++/ChangeLog-2002.bz2
/usr/share/doc/gcc-c++/ChangeLog-2003.bz2
/usr/share/doc/gcc-c++/ChangeLog-2004.bz2
/usr/share/doc/gcc-c++/ChangeLog-2005.bz2
/usr/share/doc/gcc-c++/ChangeLog-2006.bz2
/usr/share/doc/gcc-c++/ChangeLog-2007.bz2
/usr/share/doc/gcc-c++/ChangeLog-2008.bz2
/usr/share/doc/gcc-c++/ChangeLog-2009.bz2
/usr/share/doc/gcc-c++/ChangeLog-2010.bz2
/usr/share/doc/gcc-c++/ChangeLog-2011.bz2
/usr/share/doc/gcc-c++/ChangeLog-2012.bz2
/usr/share/doc/gcc-c++/ChangeLog-2013.bz2
/usr/share/doc/gcc-c++/ChangeLog-2014.bz2
/usr/share/doc/gcc-c++/ChangeLog-2015.bz2
/usr/share/doc/gcc-c++/ChangeLog-2016.bz2
/usr/share/doc/gcc-c++/ChangeLog-2017.bz2
/usr/share/doc/gcc-c++/ChangeLog.bz2
/usr/share/doc/gcc-c++/ChangeLog.ptr.bz2
/usr/share/doc/gcc-c++/ChangeLog.tree-ssa.bz2
/usr/share/man/man1/g++.1.gz

References

Summary

In this tutorial we learn how to install gcc-c++ on CentOS 8 using yum and dnf.