c++ - What is libc++ and libstdc++ - Stack Overflow
c++ - How do you find what version of libstdc++ library is installed on your linux machine? - Stack Overflow
libstdc++ vs libstdc++11 when using gcc version 8+ and -std=c++17
What is libstdc++11?
More on reddit.comgcc - What is libstdc++.so.6 and GLIBCXX_3.4.20? - Unix & Linux Stack Exchange
Can someone elaborate on what are libc, libc++, libstdc++
-
What the difference between libc++ and libstdc++? Why can't we just use one of them for all times?
-
How to determine which versions of these libs support specific standard version? For example which version of c++ standard does libstdc++-4.6 support?
-
Can i just "copy-paste" these libs into target OS to run my project if that OS lacks newer versions of these ones available in repositories?
-
Can i just "copy-paste" all dependent `.so` files into target OS? What should i consider when "copy-pasting" libraries from my development workstation to user's one?
-
libstdc++ is the GNU c++ standard library implementation.
libc++ is the LLVM/clang c++ standard library implementation.
Even when compiling with clang, libstdc++ (gnu) is often used (on Linux).
A main reason libc++ (clang) exists is that libstdc++ (gnu) is GPL and so Apple can't ship it, so you can think of libc++ as the non-GPL libstdc++.
1) What is libc++ and libstdc++ ?
They are implementations of the C++ standard library.
2) What is the difference between them ?
They are entirely different implementations.
3) Are they interchangeable ?
Yes, you should be able to use them interchangeably. (However you can't easily use both in the same program.)
5) When should I use one or another ?
You shouldn't have to worry about that. Your code should work with any standard library implementation.
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:
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
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.
There isn't actually a package called libstdc++ (possibly you are trying to install libstdc++6?)
When apt doesn't find an exact match to a package name, it treats the given string as a regular expression. In this case the ++ causes it to try to install any package whose name matches libstd followed by one or more c - many of which conflict, as you can see.
Unfortunately I have never managed to figure out how to turn off this behaviour (nothing I have tried in the past using escape characters has seemed to work) - the only solution I know is to be careful to give an exact package name where any regex characters might be misinterpreted, and to make sure the package catalog is up-to-date i.e.
sudo apt-get update
sudo apt-get install libstdc++6
First run these commands
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install aptitude
and then try
sudo apt-get install libstdc++6
or try this search result and install one desired package from listed http://packages.ubuntu.com/search?keywords=libstdc%2B%2B