Search code examples
c++c++14rhel7

how to install C++14 on RHEL 7.4


My question is similar to how to install gcc 4.9.2 on RHEL 7.4

But I'm trying to get C++14 support on Red Hat 7 so I can install mapnik.

I've tried: # yum-config-manager --enable rhel-server-rhscl-7-rpms

Install gcc, g++ version 4.9.2 : # yum install devtoolset-3-gcc-c++

Enabling gcc-4.9, g++-4.9 : $ scl enable devtoolset-3 bash

But I keep getting

C++ compiler does not support C++14 standard (-std=c++14), which is required. Please upgrade your compiler


Solution

  • The issue is that devtoolset-3 contains the c++11 standard. Making and installing GCC from source caused two GCC versions to exist together. The default being the c++11 version. In order to get the correct version of gcc I needed to install devtoolset-7 and make sure devtoolset-3 was superseded or removed.

    Here is how I enabled it:

    1. Install a package with repository for your system:

    On RHEL, enable RHSCL repository for your system:

    $ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms

    2. Install the collection:

    $ sudo yum install devtoolset-7

    3. Start using software collections:

    $ scl enable devtoolset-7 bash