【问题标题】:Setting up Kdevelop设置 Kdevelop
【发布时间】:2017-03-23 22:38:37
【问题描述】:

我正在尝试设置 Kdevelop,但遇到了编译器错误。

C:/Users/alexm/projects/SFMLGL/build> "C:/Program Files/CMake/bin/cmake.exe" "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" "-DCMAKE_BUILD_TYPE=Debug" C:/Users/alexm/projects/SFMLGL
-- The C compiler identification is unknown
CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCompilerId.cmake:141 (file):
  file problem creating directory:
  C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/3.6.1/CompilerIdCXX
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCompilerId.cmake:40 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCXXCompiler.cmake:113 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  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.


CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  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 "C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/CMakeError.log".
*** Failure: Exit code 1 ***

我一直在谷歌上搜索,并读到我应该下载“Make”,所以我有,它确实减少了我的错误数量,但我仍然有这个,我一个字都不懂。

我想它要我下载一个 C 编译器?我该怎么做呢?

【问题讨论】:

    标签: visual-c++ cmake kdevelop


    【解决方案1】:

    CMake 的默认工具链尝试使用 Visual Studio C++ 编译器。

    如果您想使用 Visual Studio(您需要安装它),您可以从开始菜单中的 »VS201X x64 本机工具命令提示符« 快捷方式运行 CMake 命令。

    另一种方法是通过 msys2 中提供的 mingw-w64 使用适用于 Windows 的 GCC。在那里,您必须通过pacman -S mingw-w64-x86_64-toolchain 安装编译器,也可以通过pacman -S mingw-w64-x86_64-cmake 安装cmake。
    然后,您可以从 msys2 的 mingw64 提示符运行您的命令。

    如果你想在 KDevelop 中使用它,你必须将你的 msys64/mingw64/ 文件夹添加到路径中,或者从上面提到的 Visual Studio 命令提示符启动它。我不确定是否有更简单的方法。

    您的问题提出了问题^^您最终想要实现什么。您似乎不知道要使用哪个编译器(如果您有二进制依赖项,这可能很重要)或 make 是什么(这有点令人担忧)。

    【讨论】:

    • 我在哪里可以了解您所说的内容?你能提供任何好的学习资源吗?顺便说一句,你做得很好。
    • 那么你想学什么,你已经知道了什么?您现在或不久的将来想要完成什么?
    • 这是一个公认的答案吗? @Darklighter 哇,真快。问题是,KDev 声称支持 VS Build Tools,但显然没有以正确的方式运行 CMake,这就是 CMake 找不到 cl 的原因。刚开始寻找解决方案,这是 google 的最高结果。
    • 你有什么问题?
    • 仅供参考,我没有收到编辑通知。我刚刚下载了 KDevelop,从 »x64 Native Tools Command Prompt for VS 2017« 运行它并成功构建了 google snappy。
    猜你喜欢
    • 1970-01-01
    • 2011-10-31
    • 2013-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多