From: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_install
If you already have an older version of libstdc++ installed then the error might look like one of the following instead:
./a.out: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found
./a.out: /usr/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found
This means the linker found /usr/lib/libstdc++.so.6 but that library belongs to an older version of GCC than was used to compile and link the program a.out (or some part of it).
The gcc dynamic linker needs the new path to the newer library:
export LD_LIBRARY_PATH=${prefix}/lib:$LD_LIBRARY_PATH
i.e.:
export LD_LIBRARY_PATH=/usr/lib64/:$LD_LIBRARY_PATH
(depending on your system you may need /usr/lib/)
Find the path:
locate libstdc++.so.6
in summary: the gcc dynamic linker searches a list of preconfigured directories as described: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_install
The shared library libstdc++.so.6 is already there we just have to point the linker to the correct location.
CXXABI_1.3.8
is present by default :$ objdump -x /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep CXXABI_1.3.8
: 32 0x00 0x0bafd178 CXXABI_1.3.8 . – Knud Larsen