When compiling a C++ project, I have recently begun to see the following error:
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h(94): catastrophic error: cannot open source file "stdlib.h"
#include_next <stdlib.h>
This is very strange because the offending line #include_next <stdlib.h>
is within the file /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h
meaning the file is somehow trying to include itself and failing.
This is a default system file so I don't understand why it should be broken suddenly. And advice would be greatly appreciated.
(Running on macOS Mojave with Intel icpc compiler)
This problem was eventually solved by running the macOS_SDK_headers_for_macOS_10.14.pkg
installer located at /Library/Developer/CommandLineTools/Packages