2
我想编译在Visual Studio代码一段cpp的文件,因此我设置了以下tasks.json:任务在Visual Studio代码没有找到文件
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "g++-5",
//"args": ["-O2", "-Wall", "${file}", "-o ${fileBasename}"],
"isShellCommand": true,
"tasks": [
{
"taskName": "Compile",
// Make this the default build command.
"isBuildCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "always",
// No args
//"args": ["all"],
"args": ["-O2", "-Wall", "${file}", "-o ${fileBasename}"],
// 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
}
}
}
]
}
但现在,如果我切换到有问题的文件(它位于.vscode
-folder,其中是tasks.json文件所在的位置),并执行编译任务,从gcc中得到“文件未找到”作为错误。我的json代码中的问题在哪里?