To find which library is being used you could run

Copy $ /sbin/ldconfig -p | grep stdc++
    libstdc++.so.6 (libc6) => /usr/lib/libstdc++.so.6

The list of compatible versions for libstdc++ version 3.4.0 and above is provided by

Copy $ strings /usr/lib/libstdc++.so.6 | grep LIBCXX
 GLIBCXX_3.4
 GLIBCXX_3.4.1
 GLIBCXX_3.4.2
 ...

For earlier versions the symbol GLIBCPP is defined.

The date stamp of the library is defined in a macro __GLIBCXX__ or __GLIBCPP__ depending on the version:

Copy// libdatestamp.cxx
#include <cstdio>

int main(int argc, char* argv[]){
#ifdef __GLIBCPP__
    std::printf("GLIBCPP: %d\n",__GLIBCPP__);
#endif
#ifdef __GLIBCXX__
    std::printf("GLIBCXX: %d\n",__GLIBCXX__);
#endif
   return 0;
}

$ g++ libdatestamp.cxx -o libdatestamp
$ ./libdatestamp
GLIBCXX: 20101208

The table of datestamps of libstdc++ versions is listed in the documentation:

Answer from Dima Chubarov on Stack Overflow
Top answer
1 of 4
124

To find which library is being used you could run

Copy $ /sbin/ldconfig -p | grep stdc++
    libstdc++.so.6 (libc6) => /usr/lib/libstdc++.so.6

The list of compatible versions for libstdc++ version 3.4.0 and above is provided by

Copy $ strings /usr/lib/libstdc++.so.6 | grep LIBCXX
 GLIBCXX_3.4
 GLIBCXX_3.4.1
 GLIBCXX_3.4.2
 ...

For earlier versions the symbol GLIBCPP is defined.

The date stamp of the library is defined in a macro __GLIBCXX__ or __GLIBCPP__ depending on the version:

Copy// libdatestamp.cxx
#include <cstdio>

int main(int argc, char* argv[]){
#ifdef __GLIBCPP__
    std::printf("GLIBCPP: %d\n",__GLIBCPP__);
#endif
#ifdef __GLIBCXX__
    std::printf("GLIBCXX: %d\n",__GLIBCXX__);
#endif
   return 0;
}

$ g++ libdatestamp.cxx -o libdatestamp
$ ./libdatestamp
GLIBCXX: 20101208

The table of datestamps of libstdc++ versions is listed in the documentation:

2 of 4
22

What exactly do you want to know?

The shared library soname? That's part of the filename, libstdc++.so.6, or shown by readelf -d /usr/lib64/libstdc++.so.6 | grep soname.

The minor revision number? You should be able to get that by simply checking what the symlink points to:

Copy$ ls -l  /usr/lib/libstdc++.so.6
lrwxrwxrwx. 1 root root 19 Mar 23 09:43 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.16

That tells you it's 6.0.16, which is the 16th revision of the libstdc++.so.6 version, which corresponds to the GLIBCXX_3.4.16 symbol versions.

Or do you mean the release it comes from? It's part of GCC so it's the same version as GCC, so unless you've screwed up your system by installing unmatched versions of g++ and libstdc++.so you can get that from:

Copy$ g++ -dumpversion
4.6.3

Or, on most distros, you can just ask the package manager. On my Fedora host that's

Copy$ rpm -q libstdc++
libstdc++-4.6.3-2.fc16.x86_64
libstdc++-4.6.3-2.fc16.i686

As other answers have said, you can map releases to library versions by checking the ABI docs

🌐
Reddit
reddit.com › r/cpp › libstdc++ vs libstdc++11 when using gcc version 8+ and -std=c++17
r/cpp on Reddit: libstdc++ vs libstdc++11 when using gcc version 8+ and -std=c++17
July 14, 2020 -

Is there a difference between libstdc++ and libstdc++11 in the current releases of gcc (or at least gcc >=8)?

I want to create libraries that support code using the C++17 standard.

I can't find any concise answer on which lib to use or if it even matters.

Discussions

Resolving library version incompatibility for libstdc++.so on recent Ubuntu versions
On an x86_64 computer running Ubuntu 22.04 (and, I think, earlier releases too) the version of libstdc++.so in /usr/lib/x86_64-linux-gnu/ is libstdc++.so.6.0.30. Julia, even when compiled from sources, provides ./usr/lib/libstdc++.so.6.0.29. The result is that operations like pre-compiling ... More on discourse.julialang.org
🌐 discourse.julialang.org
2
0
August 8, 2022
gcc - What is libstdc++.so.6 and GLIBCXX_3.4.20? - Unix & Linux Stack Exchange
I am looking for some simple answers in order to understand some of these concepts. I am trying to install a R library which is failing with the error: /lib64/libstdc++.so.6: version ``GLIBCXX_3.4... More on unix.stackexchange.com
🌐 unix.stackexchange.com
How can I have libstdc++ version and glibc version in profile
I don't like the above workaround, so I'm trying to do it by editing only my consumers' conanfile.py. I couldn't find any way to inform my dependencies about the new self.info.settings.compiler.version. Also I couldn't find a way to add this in profile instead. The same goes with libstdc++. You ... More on github.com
🌐 github.com
12
August 30, 2017
c++ - How to detect the libstdc++ version in Clang? - Stack Overflow
I would like to write a "portable" C++ library in Clang. "Portable" means that I detect (in C preprocessor) what C++ features are available in the compilation environment and use these features or More on stackoverflow.com
🌐 stackoverflow.com
🌐
Red Hat
access.redhat.com › solutions › 6969351
Which version of libstdc++ is provided in RHEL? How do we get a later GLIBCXX or CXXABI? - Red Hat Customer Portal
August 1, 2025 - Which version of libstdc++ is available on RHEL releases? How do we get a later CXXABI? If we install later GCC I can't see any way to get the matching version of the libstdc++ library. The installed version appears only to be as suppiled by the base OS RPM package.
🌐
Debian
packages.debian.org › sid › libstdc++6
Debian -- Details of package libstdc++6 in sid
libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which was included up to g++-2.95. The first version of libstdc++-v3 appeared in g++-3.0.
🌐
GNU
gcc.gnu.org › onlinedocs › libstdc++ › faq.html
Frequently Asked Questions
So any program which uses libstdc++ falls under the GPL? 2.3. How is that different from the GNU {Lesser,Library} GPL? 2.4. I see. So, what restrictions are there on programs that use the library? 3.1. How do I install libstdc++? 3.2. How does one get current libstdc++ sources?
🌐
Pale Moon Forum
forum.palemoon.org › viewtopic.php
Linux users: What version of glibc and libstdc++ is everyone on? - Pale Moon forum
December 23, 2023 - Using andyprough's commands. ldd (Ubuntu GLIBC 2.35-0ubuntu3.5) 2.35 libstdc++6: Installed: 12.3.0-1ubuntu1~22.04 Merry Christmas! ... For Linux machines I am on various Debian versions, with newer configs using Debian 12 with glibc 2.36, libstdc++ 12.2.0-14 and gcc 12 .
🌐
GNU
gcc.gnu.org › onlinedocs › libstdc++
The GNU C++ Library
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
🌐
GNU
gcc.gnu.org › onlinedocs › libstdc++ › manual › abi.html
ABI Policy and Guidelines - GCC, the GNU Compiler Collection
Release versioning on the libstdc++.so binary, implemented in the same way as the libgcc_s.so binary above. Listed is the filename: DT_SONAME can be deduced from the filename by removing the last two period-delimited numbers. For example, filename libstdc++.so.5.0.4 corresponds to a DT_SONAME of libstdc++.so.5.
Find elsewhere
🌐
GitHub
gist.github.com › ernstki › 593076d2d164ca51d4a6c0a15731846f
List the ABI versions of all detected libc and libstdc++'s (GNU/Linux only) · GitHub
The libcversions.sh included as a part of this gist reports which libc and libstdc++ ABI versions are available to running programs.
🌐
Julia Programming Language
discourse.julialang.org › tooling
Resolving library version incompatibility for libstdc++.so on recent Ubuntu versions - Tooling - Julia Programming Language
August 8, 2022 - On an x86_64 computer running Ubuntu 22.04 (and, I think, earlier releases too) the version of libstdc++.so in /usr/lib/x86_64-linux-gnu/ is libstdc++.so.6.0.30. Julia, even when compiled from sources, provides ./usr/lib/libstdc++.so.6.0.29.
🌐
Llvm
libcxx.llvm.org
“libc++” C++ Standard Library — libc++ documentation
libstdc++ 4.2 (the last GPL2 version) could be independently extended to support C++11, but this would be a fork of the codebase (which is often seen as worse for a project than starting a new independent one).
🌐
GitHub
github.com › conan-io › conan › issues › 1684
How can I have libstdc++ version and glibc version in profile · Issue #1684 · conan-io/conan
August 30, 2017 - I couldn't find any way to inform my dependencies about the new self.info.settings.compiler.version. Also I couldn't find a way to add this in profile instead. The same goes with libstdc++. You can get their versions with: strings /usr/lib/libc.so.6 | grep '^GLIBC_\([0-9.]\)' | sort -u -V | tail -n1 strings /usr/lib/libstdc++.so | grep '^GLIBCXX_\([0-9.]\)' | sort -u -V | tail -n1 ·
Author   conan-io
🌐
Debian
packages.debian.org › sid › libstdc++-13-dev
Debian -- Details of package libstdc++-13-dev in sid
libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which was included up to g++-2.95. The first version of libstdc++-v3 appeared in g++-3.0.
🌐
Reddit
reddit.com › r/cpp_questions › what new features require newer versions libstdc++?
r/cpp_questions on Reddit: What new features require newer versions libstdc++?
May 17, 2025 -

Hi,

I would like to write a testing code that only works on newer libstdc++ ( GLIBCXX_VERSION > 3.4.29) and should fail with an older libstdc++ (GLIBCXX_VERSION = 3.4.25).

I'm using gcc-14 as the compiler and have tried many new C++20 and C++23 features, like ranges, concepts, std::println. All of them still run successfully with the old version libstdc++. I also use ldd command to make sure the executable is indeed linked to the old libstdc++.

Does anyone know which new features do not work with the old libstdc++?

Why know this?

The installation of the latest version of Boost requires GLIBCXX_3.4.29 but the /usr/lib64/libstdc++.so.6 in my system only has GLIBCXX_3.4.25. I would like to write a test to show the system is now using a new libstdc++ instead of the old one.