'Build tools broken after uninstalling Xcode

When I use make to build my C++ project from the command line (cmake .., make) after installing and uninstalling xcode, make outputs make[2]: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++: No such file or directory

xcode-select -p output: /Library/Developer/CommandLineTools

sudo xcode-select --install output: xcode-select: error: command line tools are already installed, use "Software Update" to install updates

xcode-select --reset output: nothing

I uninstalled and reinstalled the xcode command line tools and it still gives the same No such file or directory error



Solution 1:[1]

CMake stores the results of its system introspection - the full path to the compiler used is one of them - in a file called CMakeCache.txt. If you change something in your system that invalidates these results you need to clear the cache, i.e. delete the CMakeCache.txt file in the build folder.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1