The symlink to the 4.8.2 directory is nothing to worry about, it's normal for the libstdc++ headers on Red Hat Enterprise Linux (and therefore CentOS) to be arranged like that.

gcc --version will tell you the version of the gcc executable in your path.

rpm -q libstdc++-devel will tell you the version of the package that owns the C++ standard library headers.

rpm -ql libstdc++-devel will list the files installed by that package, which will include the files under /usr/include/c++/4.8.2

rpm --verify libstdc++-devel will check that you haven't messed up the C++ headers by replacing them with something else.

The error is more concerning, that implies you have messed something up. My guess would be it's in the from [...omitted by myself as it is irrelevant] part, which may actually be very relevant. std::locale should be declared in <bits/locale_classes.h> which is included before <bits/locale_facets_nonio.h>, so if it wasn't declared my guess is that you have some header that defines _LOCALE_CLASSES_H and prevents the standard library header from being read. Do not define include guards that start with underscores, they are reserved names.

Answer from Jonathan Wakely on Stack Overflow
Top answer
1 of 3
15

The symlink to the 4.8.2 directory is nothing to worry about, it's normal for the libstdc++ headers on Red Hat Enterprise Linux (and therefore CentOS) to be arranged like that.

gcc --version will tell you the version of the gcc executable in your path.

rpm -q libstdc++-devel will tell you the version of the package that owns the C++ standard library headers.

rpm -ql libstdc++-devel will list the files installed by that package, which will include the files under /usr/include/c++/4.8.2

rpm --verify libstdc++-devel will check that you haven't messed up the C++ headers by replacing them with something else.

The error is more concerning, that implies you have messed something up. My guess would be it's in the from [...omitted by myself as it is irrelevant] part, which may actually be very relevant. std::locale should be declared in <bits/locale_classes.h> which is included before <bits/locale_facets_nonio.h>, so if it wasn't declared my guess is that you have some header that defines _LOCALE_CLASSES_H and prevents the standard library header from being read. Do not define include guards that start with underscores, they are reserved names.

2 of 3
3

I am not quite sure but below is more information

Stackoverflow: version of libc

Copy$ /lib/x86_64-linux-gnu/libc.so.6 
GNU C Library (Ubuntu EGLIBC 2.19-0ubuntu6) stable release version 2.19, by Roland McGrath et al.
Copyright (C) 2014 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.
Compiled by GNU CC version 4.8.2.
Compiled on a Linux 3.13.9 system on 2014-04-12.
Available extensions:
    crypt add-on version 2.1 by Michael Glad and others
    GNU Libidn by Simon Josefsson
    Native POSIX Threads Library by Ulrich Drepper et al
    BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/eglibc/+bugs>.
mandar@ubuntu:~/Desktop$ 
🌐
IBM
ibm.com › docs › en › xl-fortran-linux › 16.1.1
Determining the installed version of gcc - IBM Documentation
April 21, 2024 - Desired=Unknown/Install/Remove... Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==========-=====================-================-=================== ii gcc 4:4.8.2-1ubuntu4 ppc64el GNU C compiler...
Discussions

package management - How to figure out version of gcc in debian 8 or 9 distribution without installation? - Unix & Linux Stack Exchange
I figured out debian 8 has almost the desired version of gcc. I made a virtual machine to only find out that gcc version in debian 8.11 is 4.9.2. So my question is how I can precisely check gcc version inside the distribution (iso) without installing it? More on unix.stackexchange.com
🌐 unix.stackexchange.com
July 31, 2024
How can I know that which version of gcc compiler I am using? - Stack Overflow
In java, there is command line option javac -version to know the version that is installed on computer. I am curious to know about is there any way exist to know the version of gcc or any command l... More on stackoverflow.com
🌐 stackoverflow.com
linux - How do I check my gcc C++ compiler version for my Eclipse? - Stack Overflow
I'm using Eclipse release version 3.7.0, but I can't find the gcc anywhere. How and where can I see the version of gcc I'm currently using? More on stackoverflow.com
🌐 stackoverflow.com
ubuntu - How to robustly determine which version of GCC was used to build the kernel from bash shell - Unix & Linux Stack Exchange
What is a robust way in a bash shell to determine the version of GCC used to compile the currently running kernel? I need it in the form of major.minor.patch so that I can compare it with the last ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
January 15, 2024
People also ask

What is the difference between 'gcc --version' and 'gcc -v'?
While both 'gcc --version' and 'gcc -v' provide information about the installed GCC version, 'gcc -v' provides more detailed information about your GCC installation, including the compiler’s configuration, target system, supported languages, and the options used during the compilation process.
🌐
webhostinggeeks.com
webhostinggeeks.com › home › ubuntu › how to check gcc version on ubuntu
How to Check GCC Version on Ubuntu | Linux Tutorials for Beginners
How can I check the GCC version on my Ubuntu system?
You can check the GCC version on your Ubuntu system by opening the terminal and entering the command 'gcc --version'. This command will display the current GCC version installed on your system, along with additional information about the compiler.
🌐
webhostinggeeks.com
webhostinggeeks.com › home › ubuntu › how to check gcc version on ubuntu
How to Check GCC Version on Ubuntu | Linux Tutorials for Beginners
What is GCC and why is it important?
GCC, the GNU Compiler Collection, is a popular compiler for programming languages like C and C++. It's essential for supporting desired language features and optimizing code. Knowing the GCC version on your Ubuntu system ensures compatibility with the code you're working with, especially when dealing with recent language features or libraries.
🌐
webhostinggeeks.com
webhostinggeeks.com › home › ubuntu › how to check gcc version on ubuntu
How to Check GCC Version on Ubuntu | Linux Tutorials for Beginners
🌐
Linux Hint
linuxhint.com › check-the-version-my-gcc-compiler
How to Check the Version of Your GCC Compiler – Linux Hint
Comprehensive tutorial on understanding the GCC compiler and on how to check your GCC compiler version and locate where it is installed on your computer.
🌐
Learning About Electronics
learningaboutelectronics.com › Articles › How-to-check-the-version-of-GCC-C++-compiler-installed-windows.php
How to Check the Version of the GCC C++ Compiler Installed on a Windows PC
So you can see in this case that ... that you have installed on your PC, you can do it through the command prompt by typing in the single line, g++ --version, and this will return the result....
🌐
Web Hosting Geeks
webhostinggeeks.com › home › ubuntu › how to check gcc version on ubuntu
How to Check GCC Version on Ubuntu | Linux Tutorials for Beginners
October 7, 2023 - Knowing the GCC version on your ... You can check the GCC version on your Ubuntu system by opening the terminal and entering the command 'gcc --version'....
🌐
Medium
medium.com › @ihouelecaurcy › how-to-check-and-install-gcc-on-linux-complete-developer-guide-98697e2ab78f
How to Check and Install GCC on Linux: Complete Developer Guide | by Ihouele Caurcy | Medium
July 24, 2025 - # 1. Compilers check echo -e "\n📋 COMPILERS:" for comp in gcc g++ clang cc; do if command -v $comp >/dev/null 2>&1; then version=$($comp --version 2>/dev/null | head -n1) echo "✅ $comp: $version" else echo "❌ $comp: Not found" fi done# 2.
Find elsewhere
Top answer
1 of 2
1

A general way is to check distrowatch: https://distrowatch.com/table.php?distribution=debian. Gcc is one of the main packages in the table of releases and package versions. While distrowatch is not authoritative in such matters, it is a reality-check because they do the legwork of checking those for you, or at least parsing release notes.

About debian/ubuntu family in particular, they tend to have multiple gcc versions available within a release. They would be named "gcc-11", "gcc-12", and "gcc-13".

And you're in luck for Debian. http://snapshot.debian.org/binary/gcc/. This site helps indicate which package versions were available when in Debian. You might need to calculate on your own which release of Debian that would have been, and then find that iso, but then download this deb, or point apt to that snapshot.debian.org url and fetch the exact version of gcc you want.

2 of 2
0

In addition to packaging resources like https://repology.org (where upstream maintainers actually do the footwork of registering the package names for software, and repology then goes ahead and checks the versions available; understandably, considering there's 3152 known packagings of gcc in active distors, it doesn't track end-of-life distros like debian 8 and 9), there's of course to set up a full VM. Just a container would totally suffice:

podman run -it --rm debian:8

(use docker if you prefer that over podman).

Or maybe there is an easier solution to install specific gcc version?

If building gcc and installing it into a prefix feels like too much work, maybe just build the gcc package for your current distro using the right version of the source code?

But the container way does generally sound like the way to go here: your ICC will not be built for your modern Linux distro anyways. You can just mount a directory containing the source code you want to work with as volume in your containers, at no overhead, and just run your builds inside. Containers is how most CI works these days, so it's the standard way of getting some specific environment including a specific compiler version around.

🌐
GNU
gcc.gnu.org › faq.html
GCC Frequently Asked Questions - GNU Project
January 31, 2025 - With the above --prefix option, that will install the new GCC programs into /usr/local/gcc/bin with names prefixed by "new-". You can use --program-transform-name if you have multiple versions of GCC, and wish to be sure about which version you are invoking.
🌐
Oreate AI
oreateai.com › blog › how-to-check-your-gcc-version-on-different-operating-systems › f6ced890d74524aaf54dc5fd9c647a9e
How to Check Your GCC Version on Different Operating Systems - Oreate AI Blog
January 15, 2026 - If you'd like more detail about what’s currently set up in your environment without diving into specific package management commands, you could also try running: ``gcc --version'' to get concise info directly related to what's actively being ...
🌐
GNU
gcc.gnu.org
GCC, the GNU Compiler Collection - GNU Project
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, COBOL, Rust, and Algol 68 as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system.
🌐
Nig
sc.ddbj.nig.ac.jp › en › guides › software › DevelopmentEnvironment › gcc
C/C++ (GCC: GNU Compiler Collection)
$ which gcc /usr/bin/gcc $ gcc ... or FITNESS FOR A PARTICULAR PURPOSE. Check the available GCC versions and compilation options with the spack info command....
🌐
Finxter
blog.finxter.com › home › learn python blog › how to check your c version?
How to Check Your C Version? - Be on the Right Side of Change
June 23, 2023 - The default standard might differ between compilers and their versions. To determine the default language standard used by your compiler, you can try examining the preprocessor macros. For GCC, create a C++ file (e.g., check_version.cpp) with the following content:
🌐
QT Centre
qtcentre.org › threads › 17823-How-to-determine-the-compiler-version-(GCC)
Thread: How to determine the compiler-version (GCC)
gcc -v returns the version string. You can have a script that uses tools such as sed, cut and grep that will process its output and return only the version number or 0/1 depending on the version found.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › linux › linux find out gnu gcc compiler version used to compile running kernel
Linux Find Out GNU gcc Compiler Version Used To Compile Running Kernel - nixCraft
December 11, 2017 - How do I find out the version of my GNU gcc compiler that was used by upstream Linux distribution to compile and pack my binary Linux kernel? You need to cat the /proc/version file.
🌐
Microchip
support.microchip.com › s › article › How-to-check-Microchip-Studio-GCC-toolchain-version
How to check Microchip Studio GCC toolchain version?
July 23, 2024 - Which GCC toolchain is used in Microchip Studio? How to check? Answer · There are two methods to determine GCC Toolchain version: Using command prompt: 1)Create an environment variable for PATH. Add the executable path to the PATH variable. (eg. C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin) 2) After setting the PATH variable start a new command prompt.
🌐
GitHub
gist.github.com › gabonator › acb665922ef6c96db9211d6e8db22a9a
gcc check standard version · GitHub
gcc check standard version. GitHub Gist: instantly share code, notes, and snippets.