我已经有一段时间没有使用Clion了,这些天我尝试运行一个旧项目,它给了我这个编译错误(它过去工作得很好)。然后我创建了一个新项目进行测试,错误仍然存在。我还试着更新我的狮子。以下是错误消息:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/Applications/CLion.app/Contents/bin/ninja/mac/ninja -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/9.2.0_1/bin/g++-9 -G Ninja /Users/yzr/Desktop/untitled
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/local/Cellar/gcc/9.2.0_1/bin/g++-9
-- Check for working CXX compiler: /usr/local/Cellar/gcc/9.2.0_1/bin/g++-9 - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler
"/usr/local/Cellar/gcc/9.2.0_1/bin/g++-9"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/yzr/Desktop/untitled/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/Applications/CLion.app/Contents/bin/ninja/mac/ninja cmTC_5a895 && [1/2] Building CXX object CMakeFiles/cmTC_5a895.dir/testCXXCompiler.cxx.o
FAILED: CMakeFiles/cmTC_5a895.dir/testCXXCompiler.cxx.o
/usr/local/Cellar/gcc/9.2.0_1/bin/g++-9 -o CMakeFiles/cmTC_5a895.dir/testCXXCompiler.cxx.o -c /Users/yzr/Desktop/untitled/cmake-build-debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
dyld: Library not loaded: /usr/local/opt/isl/lib/libisl.21.dylib
Referenced from: /usr/local/Cellar/gcc/9.2.0_1/libexec/gcc/x86_64-apple-darwin18/9.2.0/cc1plus
Reason: image not found
g++-9: internal compiler error: Abort trap: 6 signal terminated program cc1plus
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
ninja: build stopped: subcommand failed.
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/yzr/Desktop/untitled/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/yzr/Desktop/untitled/cmake-build-debug/CMakeFiles/CMakeError.log".下面是我的CMakeList.txt的样子:
cmake_minimum_required(VERSION 3.21)
project(untitled)
set(CMAKE_CXX_STANDARD 14)
add_executable(untitled main.cpp)我阅读了this post并添加了环境变量,但它似乎不起作用。这真的很奇怪,因为一切都很顺利。只是我有一段时间没碰它了,现在需要看一看。以前有人遇到过这种情况吗?谢谢!
发布于 2022-03-26 22:28:27
也许您可以尝试删除以前生成的目录。由于外部环境和版本可能被更新,在以前的cmake-build-调试目录中生成的一些信息可能不再有用。因此,删除它并重新发布make文件,以查看问题是否可以解决。
https://stackoverflow.com/questions/71165445
复制相似问题