最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - tasks.json File Created with Wrong Command Argument - Stack Overflow

programmeradmin0浏览0评论

I'm a bit new to Visual Studio Code. I am struggling with an issue when I debug a new C++ program. When I set the compile debug configuration, I select the option for C:\msys64\ucrt64\bin\g++.exe from the drop-down choices, as referenced in this picture:

Unfortunately, when I try to run debug, I get a a prelaunch error, which I've determined to be caused by an incorrect command argument in the newly created tasks.json file:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\Perl64\\site\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

I then have to manually edit/change the command argument in the tasks.json file to read:

"command": "C:\\msys64\\ucrt64\\bin\\g++.exe"

This corrects the issue.

Why does it not pick up the correct path? What am I missing in settings to eliminate the need for manual editing?

BTW, I have included the value 'C:\msys64\ucrt64\bin' in the PATH system environment variable.

I was expecting not to get the prelaunch error, and I was expecting the tasks.json command argument to have the correct path:

"command": "C:\\msys64\\ucrt64\\bin\\g++.exe"
发布评论

评论列表(0)

  1. 暂无评论