onunix 2024-02-01 10:37 采纳率: 80%
浏览 24

VSCode和cmake已经安装好,请问build报错是什么原因

windows平台,VSCode和cmake已经安装好,cmd里执行cmake -version成功,build helloworld.cpp,output如下提示:请问该如何修复


[proc] Executing command: cmake --version
[proc] Executing command: cmake -E capabilities
[variant] Loaded new set of variants
[kit] Successfully loaded 0 kits from C:\Users\WST\AppData\Local\CMakeTools\cmake-tools-kits.json
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --version
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -E capabilities
[proc] The command: ninja --version failed with error: Error: spawn ninja ENOENT
[proc] The command: ninja-build --version failed with error: Error: spawn ninja-build ENOENT
[proc] The command: make --version failed with error: Error: spawn make ENOENT
[main] Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found.
[main] Configuring project: test 
[proc] The command: ninja --version failed with error: Error: spawn ninja ENOENT
[proc] The command: ninja-build --version failed with error: Error: spawn ninja-build ENOENT

[proc] The command: make --version failed with error: Error: spawn make ENOENT
[main] Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found.
[proc] The command: ninja --version failed with error: Error: spawn ninja ENOENT
[proc] The command: ninja-build --version failed with error: Error: spawn ninja-build ENOENT
[proc] The command: make --version failed with error: Error: spawn make ENOENT
[main] Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found.

然后加上了

"settings": {
        "cmake.generator": "MinGW Makefiles"
    }

又报错:
[main] Building folder: test
[rollbar] Unhandled exception: Unhandled Promise rejection: build Error: No usable generator found. {}

  • 写回答

3条回答 默认 最新

  • CSDN专家-sinJack 2024-02-01 14:02
    关注
    [rollbar] Unhandled exception: Unhandled Promise rejection: build Error: Build failed: Unable to configure the project {}
    

    原因: cmake 的路径错误(因为你的cmake是直接下载的可执行程序吧)
    解决方法: 在设置中指定 cmake的路径

    评论

报告相同问题?

问题事件

  • 修改了问题 2月1日
  • 创建了问题 2月1日

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题