我想在Visual Studio Code中编译一个cpp文件,因此我设置了以下tasks.json:
{
// 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
- 文件夹(tasks.json文件所在的文件夹)旁边)并执行编译任务,我得到&# 34;找不到文件"作为gcc的错误。我的json-code中的问题在哪里?
答案 0 :(得分:1)
有几个问题。
gcc -02 -Wall filename.cpp
执行的命令。这让我想到了接下来的两个问题......
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "gcc",
"isShellCommand": true,
"tasks": [
{
"taskName": "Compile",
// This prevents passing the taskName to the command
"suppressTaskName": true,
// Make this the default build command.
"isBuildCommand": true,
"showOutput": "always",
"args": ["-O2", "-Wall", "${file}"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
吗?如果是这样,那么您不必担心#2或如何获得不同的输出名称。tasks.json
WITH cteSubjects AS (
SELECT 'ELA' AS Subject FROM dual
UNION ALL
SELECT 'M' FROM dual
UNION ALL
SELECT 'SCI' FROM dual
)
, cteGrades AS (
SELECT 3 as grade_level
FROM dual
UNION ALL
SELECT c.grade_level + 1
FROM
cteGrades c
WHERE c.grade_level + 1 <= 12
)
SELECT *
FROM
cteGrades g
INNER JOIN cteSubjects s
ON (CASE
WHEN g.grade_level IN (5,8,11) AND s.Subject = 'SCI' THEN 1
WHEN s.Subject <> 'SCI' THEN 1
ELSE 0
END) = 1
INNER JOIN students s
ON g.grade_level = s.grade_level