I apologize for the simplicity of this question, but my background is Visual Studio C++ development on Windows and I'm trying to work out how C++ development in Linux works. I'm a bit confused by GCC versions and libc versions.
In Windows you generally have versions of the C standard library that are coupled to compiler versions. For example, if I build a program with VS2013 then I need to redistribute a specific C runtime DLL with my application; e.g. msvcr120.dll
I'm trying to figure out how this works in the Linux world. I installed CentOS 7 with dev tools, and created a simple hello world app. GCC 4.8.5 is installed by default, so I used that and then did 'ldd foo' on my app. ldd prints out /lib64/libc.so.6, and if I inspect libc.so.6 I see it's version 2.17 and compiled with GCC CC 4.8.5. This all makes complete sense.
I get confused when I install and use devtoolset-7, as per the instructions at: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
After install, "gcc --version" tells me I have GCC 7.3.1, and that binary is in /opt/rh/devtoolset-7/root/usr/bin/gcc. This is clear. What's not clear is when I do 'ldd foo' on my new binary, I still see /lib64/libc.so.6, and upon inspection it's still version 2.17 built with GCC 4.8.5. My program still runs, but I have no idea how it's working. Wouldn't libc.so.6 have a different ABI from GCC 4.8.5 than GCC 7.3.1? Coming from the Windows world I would expect to see another version of libc.so.n that GCC 7.3.1 would be using.
I get even more confused by libstdc++.so.6. Surely GCC 4.8.5 and 7.3.1 have different implementations of C++11 and beyond. How does this work?
Thanks for any information that can help me learn how the C runtime works with different compiler versions on Linux.