我在Visual Studio Code中设置了一个构建代码的任务(类似于如何设置VSCode来编译C++代码?),但正则表达式与g ++的输出不匹配.有什么我做错了吗?这是在MacOS Sierra上.
我有一个名为ItemAssignmentMatrix.cpp的源文件,第15行有一个错误行.
thisisanerror;
Run Code Online (Sandbox Code Playgroud)
我的tasks.json problemmatcher模式regexp看起来像这样:
{
"version": "0.1.0",
"command": "make",
"isShellCommand": true,
"showOutput": "always",
"echoCommand": true,
"suppressTaskName": true,
"tasks" : [
{
"taskName": "clean",
"args": ["-f" "${workspaceRoot}/Makefile" "clean"]
},
{
"taskName": "build",
"isBuildCommand": true,
"args": ["-f" "${workspaceRoot}/Makefile"],
// Use the standard less compilation problem matcher.
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
当我执行此任务时,我的Makefile(使用g ++)输出一个错误行,如:
g++ …Run Code Online (Sandbox Code Playgroud)