Reputation: 510
So, I've got a project directory laid out like so:
.vscode/
build/
src/
When I do an out-of-source build, all my compiler warnings & errors point to files with paths like ../src/stuff.cpp:123:4
, with a leading ../
because GCC is running from the build
folder.
Then when I ctrl-click on that in VSCode, it's confused:
I need to manually delete ../
every time, for VSCode to find the file.
Is there a VSCode setting I can tweak for that ?
Upvotes: 4
Views: 939
Reputation: 28783
I used the following parts in the task
"options": {
"cwd": "${workspaceFolder}/build"
},
"problemMatcher": {
"base": "$gcc",
"pattern": {
"regexp": "^../(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
Now the errors are clickable in the PROBLEMS panel
Upvotes: 2