Vscode-cpptools: Build task template use absolute path for building but relative path for problemMatcher

Created on 27 Mar 2020  Â·  3Comments  Â·  Source: microsoft/vscode-cpptools

Type: General

Environments

  • OS and Version: Windows_NT x64 10.0.18363
  • VS Code Version: 1.44.0-insider
  • C/C++ Extension Version: 0.26.3

Describe the bug

The build task templates on windows, e.g. g++.exe build active file, contains:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "g++.exe build active file",
            "command": "C:\\Users\\someone\\scoop\\apps\\gcc\\current\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\Users\\someone\\scoop\\apps\\gcc\\current\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

But the problemMatcher $gcc use relative path by default. And if there is warnings or errors emitted during the build process, we can't use the problem panel to track it down. Clicking on a problem entity will cause an error notification:

Unable to open 'test.cpp': Unable to read file 'd:\Workspaces\test\d:\Workspaces\test\test.cpp' (Error: Unable to resolve non-existing file 'd:\Workspaces\test\d:\Workspaces\test\test.cpp').

Potential fixes

Use relative path for build by default, or use absolute path for problemMatcher $gcc by default.

builtasks duplicate

Most helpful comment

All 3 comments

It's probably better to use absolute path for problemMatecher by default, as error in library files reported by compilers will use absolute path anyway.

OK, just subscribed to that PR.

Feel free to close this issue if the problem has been tracked elsewhere,
please.

On Sat, Mar 28, 2020 at 2:51 AM Sean McManus notifications@github.com
wrote:

This should be fixed by #3916
https://github.com/microsoft/vscode-cpptools/pull/3916 .

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode-cpptools/issues/5209#issuecomment-605210713,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACUBEWMVM2U5PZ5IUKSXWBTRJTYTJANCNFSM4LUWVFQQ
.

Was this page helpful?
0 / 5 - 0 ratings