Due to an implementation detail of libstdc++, it seems the include paths for the C standard library headers need to come after the include path for the C++ library headers: cstdlib does #include_next <stdlib.h> which will skip any include path before the one that found the C++ library header. Apparently, the reason for #include_next is because the C++ standard library has to provide it's own stdlib.h which does not necessarily match the C standard library header exactly.
In any case, for me, without this fix, even the most simple main.cpp with just #include <cstdlib> would not compile. With this fix, it does.
Due to an implementation detail of
libstdc++
, it seems the include paths for the C standard library headers need to come after the include path for the C++ library headers:cstdlib
does#include_next <stdlib.h>
which will skip any include path before the one that found the C++ library header. Apparently, the reason for#include_next
is because the C++ standard library has to provide it's ownstdlib.h
which does not necessarily match the C standard library header exactly.In any case, for me, without this fix, even the most simple
main.cpp
with just#include <cstdlib>
would not compile. With this fix, it does.