tasks.json config g ++发生错误:vscode中没有输入文件

时间:2016-12-24 12:16:28

标签: json c++11 compiler-errors g++ visual-studio-code

{
    /*
     * http://code.visualstudio.com/docs/editor/tasks
     * 2016.12.23
     */
    "version": "0.1.0",
    "command": "sh",
    "isShellCommand": true,
    "showOutput": "always",
    "args": [
        "-c"
    ],
    "tasks": [
        {
            "taskName": "cpplint",
            "suppressTaskName": true,
            "args": [
                "cpplint --verbose=0 --output=vs7 --linelength=80 ${cwd}/*.*"
            ]
        },
        {
            "taskName": "g++ -std=c++11 -Wall ${file} -o ${fileBasenameNoExtension}.o",
            "args": [
                //"g++ -std=c++11 -Wall ${file} -o ${fileBasenameNoExtension}.o"
            ],
            "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文件。我有一个问题是关于taskName“g ++”,当我输入

"taskName": "g++"
"args": ["g++ -std=c++11 -Wall ${file} -o ${fileBasenameNoExtension}.o"]

并按cmd + p,键入task g++,它将返回错误:

clang:错误:没有输入文件

但是,cpplint(你自己需要$ pip install cpplint)也没有参数,它工作得很好,为什么呢? THX。

0 个答案:

没有答案