我是使用C编程的初学者,如果我在CLion上启动项目,我会收到此错误代码:
C:\Program Files\JetBrains\CLion 2017.2.2\bin\cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\danie\CLionProjects\untitled2
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_CXX_COMPILER:
g++.exe
is not a full path and was not found in the PATH.
通过设置环境告诉CMake在哪里找到编译器 变量“CXX”或CMake缓存条目CMAKE_CXX_COMPILER到完整路径 编译器,或编译器名称,如果它在PATH中。
-- Configuring incomplete, errors occurred!
See also "C:/Users/danie/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "C:/Users/danie/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeError.log".
[完成]
我能做些什么才能让它发挥作用? 谢谢你的帮助。
答案 0 :(得分:4)
默认情况下,CMake希望该项目需要支持C和C ++。如果您的项目只需要C,请在project()
调用中指定:
project(<project-name> C)