当我尝试编译一个包含以下内容的简单main.cpp
时:
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
克利安告诉我:
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_C_COMPILER:
C:/cygwin64/bin/gcc.exe
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 "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
我得到了引用文件C:/cygwin64/bin/g++.exe
的CMAKE_CXX_COMPILER:
的相同消息块。
这两个MAKE文件都存在于文件夹C:\cygwin64\bin
中,该路径在Windows中被称为环境变量。
查看与这类问题相关的其他问题,我已经检查了CLION中编译器的版本设置,我有:
MAKE设置为:
谁能告诉我,为了这个程序的构建和运行,我在这里遗漏了什么?
在CMakeLists.txt
文件中,我还指定了:
cmake_minimum_required(VERSION 3.16)
project(HelloWorld1)
set(CMAKE_C_COMPILER C:\cygwin64\bin)
set(CMAKE_CXX_COMPILER C:\cygwin64\bin)
add_executable(HelloWorld1 main.cpp)
但结果仍然是一样的。
发布于 2020-04-29 18:25:28
这是CLion 2020.1中已知的regression,将在即将到来的更新中修复。
作为解决方法,我从CLion中的工具链设置页面中删除了自定义编译器路径。它检测到相同的编译器,并正常工作。
https://stackoverflow.com/questions/61489816
复制相似问题