c++ - Macbook更新后Clion编译器无法正常工作?
问题描述
我的 CLion 不允许我在下面使用此消息进行编译。有任何解决这个问题的方法吗?
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/name/CLionProjects/untitled118
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
message(FATAL_ERROR "The C compiler\n \"${CMAKE_C_COMPILER}\"\n"
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/name/CLionProjects/untitled118/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_5c666/fast && xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/name/CLionProjects/untitled118/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/name/CLionProjects/untitled118/cmake-build-debug/CMakeFiles/CMakeError.log".
解决方案
您缺少命令行工具。在更新 XCode 和/或 macOS 后,这种情况经常发生。旧版本的工具将被删除,但不会安装新工具。解决此问题的方法是:
- 按照最新版本 XCode 的说明安装命令行工具。这可以通过命令行以及通过 XCode 的首选项来完成。
- 从 CLion 清理并重建 CMake 项目,以便根据最新路径重新生成 Makefile。
推荐阅读
- docker - 使用 JDBC 输入插件在 Docker 上的 Logstash 不会从 SQL Server 获取所有行
- flutter - 如何突出显示我在字符串中搜索的确切单词,而不仅仅是字符串的开头?
- flutter - 如何实时获取文档长度
- javascript - Reactjs 从获取请求中返回一个对象
- javascript - Nginx 正在尝试打开文件而不是重定向到代理
- python - _joint_log_likelihood 给我错误的值
- sql - 如何按日期获取最后一件商品的价格
- python-3.x - 定期执行功能而不停止其他操作
- r - 使用 R 从 PDF 表单到数据框的文本挖掘
- r - 如果 r 中出现错误,则转到 lapply() 的下一次迭代