VSCode 报错

vscode报错

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.

解决办法:

1、首先确认安装了gcc make cmake

  • mingw64/mingw-w64-x86_64-gcc
  • mingw64/mingw-w64-x86_64-make
  • mingw64/mingw-w64-x86_64-cmake
  •  

2、通过Ctrl + Shift + P 打开 settings.json,输入并选择 Preference: Open settings (JSON)

然后添加以下内容:

    "cmake.cmakePath": "C:\\msys64\\mingw64\\bin\\cmake.exe",
    "cmake.mingwSearchDirs": [
      "C:\\msys64\\mingw64\\bin"
   ],
   "cmake.generator": "MinGW Makefiles"

3、通过Ctrl + Shift + P 然后输入 CMake: Edit User-Local CMake Kits , 就会打开 cmake-tools-kits.json。这时候输入:

  {
    "name": "Mingw64 GCC 9.3.0",
    "compilers": {
      "C": "C:\\msys64\\mingw64\\bin\\gcc.exe",
      "CXX": "C:\\msys64\\mingw64\\bin\\g++.exe"
    },
    "preferredGenerator": {
      "name": "MinGW Makefiles",
      "platform": "x64"
    },
    "environmentVariables": {
      "PATH": "C:/msys64/mingw64/bin/"
    }
  }

外文链接:https://github.com/microsoft/vscode-cmake-tools/issues/880

如果有帮助请点赞

 

上一篇:关于generator的介绍


下一篇:爬虫之scrapy模拟登陆