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.
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.
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$
package management - How to figure out version of gcc in debian 8 or 9 distribution without installation? - Unix & Linux Stack Exchange
How can I know that which version of gcc compiler I am using? - Stack Overflow
linux - How do I check my gcc C++ compiler version for my Eclipse? - Stack Overflow
ubuntu - How to robustly determine which version of GCC was used to build the kernel from bash shell - Unix & Linux Stack Exchange
What is the difference between 'gcc --version' and 'gcc -v'?
How can I check the GCC version on my Ubuntu system?
What is GCC and why is it important?
Videos
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.
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.
Just type
gcc --version
in any terminal near you.. ;-)
gcc -dumpversion
-dumpversionPrint the compiler version (for example,3.0) — and don't do anything else.
The same works for following compilers/aliases:
cc -dumpversion
g++ -dumpversion
clang -dumpversion
tcc -dumpversion
Be careful with automate parsing the GCC output:
- Output of
--versionmight be localized (e.g. to Russian, Chinese, etc.) - GCC might be built with option --with-gcc-major-version-only. And some distros (e.g. Fedora) are already using that
- GCC might be built with option --with-pkgversion. And
--versionoutput will contain something likeAndroid (5220042 based on r346389c) clang version 8.0.7(it's real version string)