当我尝试在VS Code中构建C任务时,它显示以下消息:
输出只是显示了这一点:The task provider for "C/C++" tasks unexpectedly provided a task of type "shell".
我仍然可以使用gcc 'filename.c' -o 'output.exe'
在cmd中手动构建C文件。转到Terminal -> Run Task
而不是使用快捷键CTRL+ CTRL +B似乎也可以工作。
我在MinGW中使用了0.28.0-insiders 2 C/C++ VS Code扩展。VS Code今天刚刚更新为V。1.45,我相信这可能是这个错误的原因,因为我以前没有得到它。
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Makefile Debug_gcc",
"type": "shell",
"command": ["mingw32-make"],
"args": [
"--directory=${fileDirname}/",
"DEBUG=1",
"EXECUTABLE=${fileBasenameNoExtension}Debug"
]
},
{
"label": "Makefile Release_gcc",
"type": "shell",
"command": ["mingw32-make"],
"args": [
"--directory=${fileDirname}/",
"DEBUG=0",
"EXECUTABLE=${fileBasenameNoExtension}Release"
]
},
{
"label": "Release",
"type": "shell",
"command": "gcc",
"args": [
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}Release"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Debug",
"type": "shell",
"command": "gcc",
"args": [
"${file}",
"-g3",
"-o",
"${fileDirname}/${fileBasenameNoExtension}Debug"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Makefile Debug",
"type": "shell",
"command": ["del /S *.o"],
"dependsOn": [
"Makefile Debug_gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Makefile Release",
"type": "shell",
"command": ["del /S *.o"],
"dependsOn": [
"Makefile Release_gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Makefile Debug + Execute",
"type": "shell",
"command": "${fileDirname}/${fileBasenameNoExtension}Debug",
"dependsOn": [
"Makefile Debug"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Makefile Release + Execute",
"type": "shell",
"command": "${fileDirname}/${fileBasenameNoExtension}Release",
"dependsOn": [
"Makefile Release"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Debug Execute",
"type": "shell",
"command": "${fileDirname}/${fileBasenameNoExtension}Debug",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Release Execute",
"type": "shell",
"command": "${fileDirname}/${fileBasenameNoExtension}Release",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
}
]
}
1条答案
按热度按时间e0bqpujr1#
导航到**.vscode ->并在那里添加以下两个文件。这是我的文件和代码文件,用于编译,调试和运行c代码**。
task.json
launch.json