C++ – CMake error no CMAKE_C_COMPILER could be found using Xcode and GLFW

ccmakexcode

I'm trying to follow this tutorial to get started with OpenGL: http://www.learnopengl.com/#!Getting-started/Creating-a-window and it requires downloading glfw and CMake.
I have set the downloaded glfw folder as the source code folder and I have created inside that folder another one called "build" which I then set as the build one for the binaries, as the tutorial asks.
I click on "Configure" and I select XCode as the Generator, since I'm on a Mac.
The problem is that when I try to configure the project CMake gives me this error:

The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_C_COMPILER could be found.

Configuring incomplete, errors occurred!
See also
"/Users/standard/Desktop/glfw-3.2.1/build/CMakeFiles/CMakeOutput.log".

See also
"/Users/standard/Desktop/glfw-3.2.1/build/CMakeFiles/CMakeError.log".

I've already read this question, but as far as I can understand, it doesn't have what I need:
CMake Error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found

Thank you.

Best Answer

If you have installed Xcode or Command Line Tools for Xcode, try this:

sudo xcode-select --reset
Related Topic