VSCode 报错

2021/6/2 18:29:46

本文主要是介绍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、

如果有帮助请点赞

 



这篇关于VSCode 报错的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程