Stdlib.h file not found and macOS SDK package installer also not found

high sierraxcode

I have macOS High Sierra 10.13.6 (For various reason I will not update)
and Xcode 10.1 installed alongside command-line-tools.

I am trying to compile a certain software that is attempting to open the following header file:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h

but it cannot find the file. When I manually explore the folder, the stdlib.h file is located at:

Developer/CommandLineTools/sr/include/c++/v1/stdlib.h

I have tried so many things, from uninstalling and reinstalling, to trying out older versions, etc. I tried to "manually" install it, but there is no macOS SDK package to install.

Best Answer

Apple has an installer for C++ libraries you can install.

xcode-select --install

If you have Xcode installed (or don't mind downloading it from the App Store) run it to validate all the command line tools are installed as well as additional tools. Lastly, once these are installed, check for normal software updates to ensure the command line updates are applied.

You might need to look at the output of the build script to see if you just need to reset the default location of the compile tools:

xcode-select --reset