【问题标题】:CMAKE ERROR with CLionCLion 出现 CMAKE 错误
【发布时间】:2017-09-02 08:51:29
【问题描述】:

我是 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".

[完成]

我该怎么做才能让它工作? 感谢您的帮助。

【问题讨论】:

  • 您似乎安装了 C 编译器 (gcc),但没有安装 C++ 编译器 (g++)。
  • 我用 C 编程,所以我不需要 C++ 编译器。

标签: c cmake mingw clion


【解决方案1】:

默认情况下,CMake 预计项目需要同时支持 C 和 C++。如果您的项目只需要 C,请在 project() 调用中指定:

project(<project-name> C)

【讨论】:

    猜你喜欢
    • 2020-07-25
    • 2017-07-29
    • 2017-06-06
    • 2018-03-27
    • 1970-01-01
    • 1970-01-01
    • 2022-12-10
    • 2023-01-27
    • 2018-08-01
    相关资源
    最近更新 更多