For gcc 4.8.4 you need to use -std=c++1y in later versions, looks like starting with 5.2 you can use -std=c++14.

If we look at the gcc online documents we can find the manuals for each version of gcc and we can see by going to Dialect options for 4.9.3 under the GCC 4.9.3 manual it says:

‘c++1y’

The next revision of the ISO C++ standard, tentatively planned for 2014. Support is highly experimental, and will almost certainly change in incompatible ways in future releases.

So up till 4.9.3 you had to use -std=c++1y while the gcc 5.2 options say:

‘c++14’ ‘c++1y’

The 2014 ISO C++ standard plus amendments. The name ‘c++1y’ is deprecated.

It is not clear to me why this is listed under Options Controlling C Dialect but that is how the documents are currently organized.

Answer from Shafik Yaghmour on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 61633828 › how-to-use-make-with-c14-with-gcc-4-8-5-on-redhat-7-5
makefile - How to use make with C++14 with gcc 4.8.5 on RedHat 7.5 - Stack Overflow
I have tried to set the C++ to 14 as follows: cmake -G "Unix Makefiles" -D CMAKE_CXX_STANDARD=14 · And then I ran "make". ... Sounds like a bug in whatever software you're trying to build. ... Just to be clear, you're using cmake here to generate your makefiles. You should tag this question with cmake not makefile.
🌐
GNU
gcc.gnu.org › releases.html
GCC Releases - GNU Project
April 30, 2026 - GCC releases may be downloaded from our mirror sites · Important: these are source releases, so will be of little use if you do not already have a C++ compiler installed. As one option, there are pre-compiled binaries. for various platforms
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-4.8.5 › gcc
Using the GNU Compiler Collection (GCC)
This manual documents how to use the GNU compilers, as well as their features and incompatibilities, and how to report bugs. It corresponds to the compilers (GCC) version 4.8.5. The internals of the GNU compilers, including how to port them to new targets and some information about how to write ...
🌐
GitHub
github.com › HenrikBengtsson › CBI-software › issues › 16
R: Minimal gcc versions in order to support C++14 and C++17? · Issue #16 · HenrikBengtsson/CBI-software
April 23, 2021 - Star 5 · New issueCopy link · ... $ gcc --version | head -1 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) which only gives us support for C++11 [1]. More and more R packages, and their dependent libraries, rely on C++14 and ...
Author   HenrikBengtsson
🌐
GNU
gcc.gnu.org › projects › cxx-status.html
C++ Standards Support in GCC - GNU Project
May 4, 2026 - This feature was briefly part of the C++14 working paper, but was not part of the published standard; as a result, it has been removed from the compiler. GCC 4.8.1 was the first feature-complete implementation of the 2011 C++ standard, previously known as C++0x.
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-4.8.2 › gcc
GCC 4.8.2 Manual - GCC, the GNU Compiler Collection
This manual documents how to use the GNU compilers, as well as their features and incompatibilities, and how to report bugs. It corresponds to the compilers (GCC) version 4.8.2. The internals of the GNU compilers, including how to port them to new targets and some information about how to write ...
Top answer
1 of 2
1

it worked with the following:

../gcc-4.8.5/configure CC="/opt/gcc4.5/bin/gcc" --prefix=/opt/gcc4.8.5 --enable-languages=c,c++,fortran --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object

The interesting part is CC=...

The installed gcc-version is 4.4. With this version, the compiling fails.

kind regards

2 of 2
1

GCC is documented to need to be built outside of its source tree; see the configuring chapter of its installation documentation:

First, we highly recommend that GCC be built into a separate directory from the sources which does not reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn’t get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.

So you need to build it according to that rule. Hence your GCC build:

cd gcc-4.8.5
#wrong code from the original question! Don't use that
./configure --enable-bootstrap --enable-shared \
      --enable-threads=posix --enable-checking=release \
      --with-system-zlib --enable-__cxa_atexit \
      --disable-libunwind-exceptions --enable-gnu-unique-object \
      --enable-languages=fortran,c --prefix=/opt/gcc4.8.5

is wrong; I would recommend at least:

  cd gcc-4.8.5
  mkdir ../_BuildGCC
  cd ../_BuildGCC
  ../gcc-4.8.5/configure --enable-bootstrap --enable-shared \
      --enable-threads=posix --enable-checking=release \
      --with-system-zlib --enable-__cxa_atexit \
      --disable-libunwind-exceptions --enable-gnu-unique-object \
      --enable-languages=fortran,c --prefix=/opt/gnu \
      --program-suffix=-mine

then, after the entire build, probably with

 make -j4

followed by some mkdir /opt/gnu with appropriate user and permission, then (in the same _BuildGCC)

make install DESTDIR=/tmp/gccinst

and finally cp -vr /tmp/gccinst/opt/gnu /opt/gnu to be run appropriately (perhaps as root...., and perhaps cp -va)

Then you would add /opt/gnu/bin/ to your PATH variable, and you would use gcc-mine to compile your code.

BTW, GCC is compatible for C programs since the ABI don't change. And GCC 4.8 is obsolete and unsupported. You'll better compile from source the supported versions (listed on gcc.gnu.org; in January 2018, GCC 7.2 & GCC 6.4)

Perhaps your particular Redhat system requires additional/specific CFLAGS to be appended into your configure command. You could ask your Redhat support, or try to append CFLAGS=-fPIE or CFLAGS=-fPIC at the end of your ../gcc-4.8.5/configure command.

At last, you might perhaps get such help on [email protected], but you'll better try with a recent GCC. Few GCC folks remember 4.8 ....

If you really need precisely GCC 4.8 (but I doubt that), you could buy costly support (e.g. from RedHat or AdaCore folks) if needed.

With Google I found Installing gcc 4.8 and Linuxbrew on CentOS 6

Find elsewhere
🌐
GNU
ftp.gnu.org › gnu › gcc › gcc-4.8.5
Index of /gnu/gcc/gcc-4.8.5
Index of /gnu/gcc/gcc-4.8.5 · Apache/2.4.52 (Trisquel_GNU/Linux) Server at ftp.gnu.org Port 443
🌐
GitHub
github.com › oddconcepts › gcc-4.8.5
GitHub - oddconcepts/gcc-4.8.5: GCC 4.8.5, with patches for newer GCC/glibc versions · GitHub
GCC 4.8.5, with patches for newer GCC/glibc versions - oddconcepts/gcc-4.8.5
Author   oddconcepts
🌐
Red Hat
access.redhat.com › solutions › 19458
What GCC versions are available in Red Hat Enterprise Linux? - Red Hat Customer Portal
July 21, 2025 - gcc · gdb · Category · Developer · Tags · c++ g++ rhel_3 · rhel_4 · rhel_5 · rhel_6 · This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers.
🌐
GNU
gcc.gnu.org › gcc-4.8
GCC 4.8 Release Series - GNU Project
The GNU project and the GCC developers are pleased to announce the release of GCC 4.8.5. This release is a bug-fix release, containing fixes for regressions in GCC 4.8.4 relative to previous releases of GCC.
🌐
GNU
gcc.gnu.org › gcc-4.8 › changes.html
GCC 4.8 Release Series — Changes, New Features, and Fixes - GNU Project
This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here). This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.8.5 release.
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-8.5.0 › gcc
Top (Using the GNU Compiler Collection (GCC))
This manual documents how to use the GNU compilers, as well as their features and incompatibilities, and how to report bugs. It corresponds to the compilers (GCC) version 8.5.0. The internals of the GNU compilers, including how to port them to new targets and some information about how to write ...
🌐
GNU
gcc.gnu.org › news.html
GCC news and announcements - GNU Project
Support for all C++14 language features has been added to the development sources for GCC, and will be available when GCC 5 is released next year. Contributed by Jason Merrill, Braden Obrzut, Adam Butcher, Edward Smith-Rowland, and Jakub Jelinek. GCC 4.8.4 released [2014-12-19] JIT support ...
🌐
GNU
gcc.gnu.org › onlinedocs
GCC online documentation - GNU Project
May 6, 2026 - GCC 4.8.5 Quad-Precision Math Library Manual (also in PDF or PostScript or an HTML tarball) ... Please note that the following documentation refers to current development.