Add the -isysroot
flag to your compile flags to automatically include the appropriate SDK header directory and avoid the need for the /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
package that will "in a future release, ... no longer be provided."
Examples:
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
or
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
You can use xcrun --show-sdk-path
to find the default SDK path.
You can also use the Xcode or CommandLineTools installed /usr/bin/ versions of clang, clang++, cc, c++, gcc, g++ which are shims calling xcrun
to invoke the correct tool with the currect SDK and include directories.
This defaults to CommandLineTools if you have that installed.
You can switch the behavior to use Xcode by:
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
or switch back:
$ sudo xcode-select -s /Library/Developer