我刚刚开始使用 C++ 和 CLion IDE。在观看了一个展示如何开始使用 CLion 的 YouTube 视频后,我收到了这个错误。我所做的只是尝试将 GCC 添加到 CLion 作为 C++ 的编译器。没有别的。
我有 GCC 版本 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
我只在 HTML CSS 和 JS 上编程了大约 3 个月,所以这个错误超出了我的理解。任何帮助将不胜感激!
下面是我的错误和屏幕截图的链接
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_CXX_COMPILER:
GCC
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/dominic/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/home/dominic/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeError.log".
[Failed to reload]
Cmake List
最佳答案
如果您只想使用 gcc
,请使用编译器的完整路径或将 gcc 路径添加到 PATH .
我猜如果你指定 C 编译器为 /usr/bin/gcc
(或 /usr/local/bin/gcc
如果你安装了它)和 C++ 编译器为 /usr/bin/g++
在首选项 |构建、执行、部署 |工具链一切正常。
请注意 Linux 是区分大小写的操作系统,GCC 可执行文件是 gcc
.
关于c++ - CLion 编译器设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61572818/