关于c ++:为什么CLion无法在Mac上编译?

Why wont CLion compile on my Mac?

我安装了CLion以及Xcode命令行工具,但仍然无法编译简单的" Hello,World!"。码。我怎样才能解决这个问题?
这是我得到的错误:

/Applications/CLion.app/Contents/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE =调试-G"代码块-Unix Makefiles" / Users / JoshGarza / CLionProjects / untitled
-C编译器标识未知
-CXX编译器标识未知
-检查工作的C编译器:/ usr / bin / cc
-检查工作的C编译器:/ usr / bin / cc-损坏
在/Applications/CLion.app/Contents/bin/cmake/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake中的CMake错误:51(消息):
C编译器" / usr / bin / cc"无法编译简单的测试程序。

它失败,并显示以下输出:

更改目录:/ Users / JoshGarza / CLionProjects / untitled / cmake-build-debug / CMakeFiles / CMakeTmp

运行构建命令:" / usr / bin / make"" cmTC_1b703 / fast"

xcode-select:注意:找不到开发人员工具
'/Applications/Xcode.app',请求安装。在中选择一个选项
对话框以下载命令行开发人员工具。

CMake将无法正确生成此项目。
呼叫堆栈(最近的呼叫优先):
CMakeLists.txt:2(项目)

-配置不完整,发生错误!
另请参见" /Users/JoshGarza/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeOutput.log"。
另请参阅" /Users/JoshGarza/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeError.log"。

[恢复先前的CMake输出:17年4月2日,下午6:42]


xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

此错误意味着您尚未安装在CLion上运行代码所必需的命令行工具。

如果您使用的是OS X 10.11 El Capitan,OS X 10.10 Yosemite和OS X 10.9及更高版本,请按照以下步骤操作以获取命令行工具(CDT),而无需再次重新安装XCode:

  • Open a Terminal window.
  • Type xcode-select --install
  • A dialog will appear telling you that it requires the command line developer tools, and asks if you would like to install them. Click on the"Install" button.

Source: How to Install CDT (Without Xcode)

如果您使用的版本比上述版本旧,请访问此网站:

  • Install CDT Without XCode in Mac OS X