导航

在以cmake . 企图运行CMakeLists 时, VS code 报错:
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
-- Configuring incomplete, errors occurred!
经过搜寻大佬们的帖子尝试运行

  1. 以下命令:
    cmake -G "MinGW Makefiles" .
    依旧没有解决问题。
  2. 尝试添加环境变量
    Variable: CMAKE_GENERATOR
    Value: MinGW Makefiles
    依旧没有解决问题。

最后通过此帖子:https://stackoverflow.com/questions/45150172/cmake-error-cmake-was-unable-to-find-a-build-program-corresponding-to-mingw-ma
决定通过卸载mingw64后通过MinGW installation manager重装mingw,并确保勾选mingw32-make

重新运行cmake .(后面笔者发现仍需要运行cmake -G "MinGW Makefiles"指定generator):

Cmake正常运行。