通常我在这个网站上遵循以下步骤:配置tasks.json文件并使用简单的hello word.c程序,
https://code.visualstudio.com/docs/cpp/config-mingw#:~:text=使用%20GCC%20和%20MinGW,debug%20a%20Hello%20World%20program.
使用“CTL+SHIFT+B”后,弹出下面这个错误
执行任务:C:\msys64\ucrt64 in\g++.exe -o hello hello.c
终端进程“C:\Windows\System32\WindowsPowerShell 1.0\powershell.exe -Command **C:\msys64\ucrt64 in\g++.exe -o hello hello.c”终止,退出代码为:1。* *
终端将被任务重用,按任意键关闭它。
有什么想法吗?请帮忙,谢谢! ** 任务.json **
安装了MSYS2,并更新,相应地配置tasks.json,
{
"version": "2.0.0",
"tasks": [
{
"label": "Compile C Code",
"type": "shell",
"command": "C:\\msys64\\ucrt64\\bin\\g++.exe",
"args": [
"-o",
"hello",
"hello.c"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always"
}
}
]
}
接受建议
Ngl,如果你使用 c,我强烈建议设置代码块而不是 VS 我只会将 VS 与 cpp 一起使用