Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vscode "Unable to open [file]: Unable to read file" message when clicking on an error

I get this message when I click on a warning. This is a screenshot of the case. enter image description here

The error reads,

Unable to open 'warning.cpp': Unable to read file '/Users/dimen/code/C++/Users/dimen/code/C++/warning.cpp' (Error: Unable to resolve non-existing file '/Users/dimen/code/C++/Users/dimen/code/C++/warning.cpp').

My script is located in /Users/dimen/code/C++/warning.cpp so vscode reiterates the path for some reason.

I suspected that the linter setting must've been written erroneously but I'm not sure where I should edit. As some side notes,

  • Using Microsoft's C/C++ extension.
  • tasks.json have been customized so that all the builds go inside the build folder
like image 713
Dimen Avatar asked Mar 01 '20 04:03

Dimen


1 Answers

You need to edit the problemMatcher part of tasks.json so that it has a variable called fileLocation that is set to absolute. Here is an example of what it should look like:

"problemMatcher": {
    "base" : "$gcc",
    "fileLocation" : "absolute"
}

I hope this helps.

like image 77
aggserp4 Avatar answered Oct 02 '22 13:10

aggserp4