有人在winodw11中成功为Visual Studio代码正确设置了gcc/g++编译吗?

问题描述 投票:0回答:1

通常我在这个网站上遵循以下步骤:配置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"
            }
        }
    ]
}

接受建议

c visual-studio-code compiler-errors compilation msys2
1个回答
0
投票

Ngl,如果你使用 c,我强烈建议设置代码块而不是 VS 我只会将 VS 与 cpp 一起使用

© www.soinside.com 2019 - 2024. All rights reserved.