c++ 在VSCode中无法识别“make”,“无法识别术语”make“”

yc0p9oo0  于 2023-03-20  发布在  Vscode
关注(0)|答案(1)|浏览(457)

我尝试在Visual Studio Code中调试我的MinGW-64 C++程序,但我甚至在构建它时都遇到了很多麻烦,因为VSCode无法识别make。我有一个生成文件,我从命令行构建它时没有遇到任何问题。我使用以下tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "C/C++: g++.exe build active file",
            "type": "shell",
            "command": "make",
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ]
}

不幸的是,我在构建时遇到此错误:

make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path 
is correct and try again.

那么,如何使用makefile在Visual Studio Code中生成(然后调试)程序呢?
[What我已经试过了]
我已经检查了Makefile Tools扩展名的设置,并确认Makefile Path和Make Path都已设置:

  • 生成文件:生成文件路径 *

[Project directory]\src\Makefile

  • 生成文件:生成路径 *

[...]\msys\mingw64\bin\mingw32-make.exe
我还确认了在命令行中输入make[...]\msys\mingw64\bin\mingw32-make.exe同样有效,所以make程序的路径是正确的,也许在vscode中有另一个我不知道的路径需要设置。

yshpjwxd

yshpjwxd1#

尝试指定文件的完整路径而不是"command": "make" . "command":"[...]\msys\mingw64\bin\mingw32-make.exe" .

相关问题