How to avoid system standard C/C++ library on linux?
<p>I installed a new version of <code>GCC</code>, which is sort contaminate my linux system. I plan to handle multiple versions of <code>GCC</code> in a better way. I plan to have all different versions installed under /opt/tools directory. And then my project makefile explicitly specifies the version to use. That includes all the binary executable, i.e. g++, gcc etc., and header files, libraries...</p>

<p>The benefit of this approach is clear. The build is more reproducible. It does not assume the version but pick the very specific one. Switching between different compiler versions all happens inside makefile.</p>

<p>To achieve that I use "-nostdinc" and put all include path explicitly into my compile command line. My code includes <code>limits.h</code> and it causes weird build error.</p>

<p><code>limits.h</code> is part of libc6-dev installed in my debian. But it's not in gcc's include directory. Some online material says standard <code>C</code> lib is part of OS. My question is that is it practical to build code independent of system header files and libraries? I doubt there might be other headers are missing from gcc. Originally, I thought gcc comes with everything. It's not the case?</p>

<p>In other words, do system libraries and headers depends on specific GCC version that comes with the debian distribution? I kind of feeling uncomfortable that system headers and libs are from let's say GCC 4.7, and I am using GCC 5.3.</p>