You can use commands such as repoquery <string>
or yum search <string>
to search for packages that are available in your repositories.
Examples
$ repoquery 'gcc*'
gcc-0:4.5.1-4.fc14.x86_64
gcc-c++-0:4.5.1-4.fc14.x86_64
gcc-gfortran-0:4.5.1-4.fc14.i686
gcc-gfortran-0:4.5.1-4.fc14.x86_64
gcc-gnat-0:4.5.1-4.fc14.x86_64
gcc-java-0:4.5.1-4.fc14.x86_64
gcc-objc-0:4.5.1-4.fc14.x86_64
gcc-objc++-0:4.5.1-4.fc14.x86_64
gccxml-0:0.9.0-0.6.20110211.fc14.x86_64
Or this:
$ yum search gcc | grep '^gcc'
gcc-gnat.x86_64 : Ada 95 support for GCC
gcc-objc.x86_64 : Objective-C support for GCC
gcc-objc++.x86_64 : Objective-C++ support for GCC
gccxml.x86_64 : XML output extension to GCC
gcc.x86_64 : Various compilers (C, C++, Objective-C, Java, ...)
gcc-c++.x86_64 : C++ support for GCC
gcc-gfortran.i686 : Fortran support
gcc-gfortran.x86_64 : Fortran support
gcc-java.x86_64 : Java support for GCC
If neither of these search returns any matches, or the "g++" results are missing from them, then you'll need to add a repository to RHEL that does contain these packages.
As always you can find out what repositories you're configured to use with this command, for example, here are the 1st 15 that I have on my Fedora system:
$ yum repolist | head -15
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
repo id repo name status
Dropbox Dropbox Repository 4
adobe-linux-i386 Adobe Systems Incorporated 17
adobe-linux-x86_64 Adobe Systems Incorporated 2
fedora Fedora 14 - x86_64 22,161
google-chrome google-chrome 3
google-earth google-earth 1
google-talkplugin google-talkplugin 1
lamolabs LamoLabs Repo 58
lamolabs-noarch LamoLabs Repo 2
nautilus-flickr-uploader Nautilus Flickr Uploader for Fedora 14 3
rpmfusion-free RPM Fusion for Fedora 14 - Free 411
rpmfusion-free-updates RPM Fusion for Fedora 14 - Free - Updates 642
RHEL
Since you're using RHEL I think things are slightly different for you. I'd consult the official documentation from Redhat since you're paying for the support contract anyway.
According to this page, 2.2. GNU C++ Compiler, you can do the following to install g++.
excerpt
2.2.1. Installing the C++ Compiler
In Red Hat Developer Toolset, the GNU C++ compiler is provided by the devtoolset-1.1-gcc-c++ package, and is automatically installed with the devtoolset-1.1 package as described in Section 1.5, “Installing Red Hat Developer Toolset”.
2.2.2. Using the C++ Compiler
To compile a C++ program on the command line, run the g++ compiler as follows:
scl enable devtoolset-1.1 'g++ -o output_file source_file...'
This creates a binary file named output_file in the current working directory. If the -o option is omitted, the g++ compiler creates a file named a.out by default.
When you are working on a project that consists of several source files, it is common to compile an object file for each of the source files first and then link these object files together. This way, when you change a single source file, you can recompile only this file without having to compile the entire project. To compile an object file on the command line, run the following command:
scl enable devtoolset-1.1 'g++ -o object_file -c source_file'
This creates an object file named object_file. If the -o option is omitted, the g++ compiler creates a file named after the source file with the .o file extension. To link object files together and create a binary file, run:
scl enable devtoolset-1.1 'g++ -o output_file object_file...'
Note that you can execute any command using the scl utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset g++ as default:
scl enable devtoolset-1.1 'bash'
yum search gcc | grep ++
. – goldilocks Nov 23 '13 at 20:20