Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking error not shown in the Problems panel #4957

Closed
psclkhoury opened this issue Feb 12, 2020 · 3 comments
Closed

Linking error not shown in the Problems panel #4957

psclkhoury opened this issue Feb 12, 2020 · 3 comments
Labels
Feature Request help wanted Can be fixed in the public (open source) repo. tasks/build/debug An issue relating to tasks.json (e.g. build issues)
Milestone

Comments

@psclkhoury
Copy link

The linking errors are not shown in the Problems panel.
Using cl.exe and makefiles to build.

@sean-mcmanus sean-mcmanus added tasks/build/debug An issue relating to tasks.json (e.g. build issues) Feature Request help wanted Can be fixed in the public (open source) repo. labels Feb 12, 2020
@michelleangela michelleangela added this to the Triage milestone Feb 12, 2020
@psclkhoury
Copy link
Author

@sean-mcmanus could you provide some hints of what should be done to try and give it a go myself?

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Feb 13, 2020

You could try to add a problem matcher or modify the existing one: That's what we do for gcc: https://github.com/microsoft/vscode-cpptools/blob/master/Extension/package.json#L76 .

If using the problemMatcher json isn't powerful enough, you could write a wrapper for gcc and/or it's linker that outputs its own diagnostics/problems (potentially also dealing with #4128 ). Info at https://code.visualstudio.com/api/references/vscode-api#Diagnostic and https://code.visualstudio.com/api/references/contribution-points#contributes.taskDefinitions might be useful.

There's also a new VS Code problem matcher API being discussed: microsoft/vscode#59337 .

@psclkhoury
Copy link
Author

I realized that I am using the msCompile problem matcher which comes from vscode and not the gcc one that comes from the c/c++ extension.

I solved my problem by writing a custom problem matcher for linking errors and combining it with the msCompile one.

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "shell",
      "label": "cl.exe build active file",
      "command": "cl.exe",
      "args": [
        "/Zi",
        "/EHsc",
        "/Fe:",
        "${fileDirname}\\${fileBasenameNoExtension}.exe",
        "${file}"
      ],
      "problemMatcher": [
        "$msCompile",
        {
          "fileLocation": "autoDetect",
          "pattern": {
            "regexp": "^([^\\s].*)\\s*:\\s+(?:fatal\\s+)?(error|warning)\\s+(LNK\\d+)\\s*:\\s*(.*)\\[(.*)\\]$",
            "kind": "file",
            "severity": 2,
            "code": 3,
            "message": 4,
            "file": 5
          }
        }
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}

I will close this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Request help wanted Can be fixed in the public (open source) repo. tasks/build/debug An issue relating to tasks.json (e.g. build issues)
Projects
None yet
Development

No branches or pull requests

3 participants