使用task.json编译和运行的Visual Studio代码

时间:2020-09-01 07:52:03

标签: c++ visual-studio-code

要在cmd中编译并运行

g ++ -std = c ++ 11 -O2 -Wall fileName.cpp -o fileName &&“ ./fileName”

对于VS code Terminal>配置任务

task.json

    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build",
            "type": "shell",
            "command": "g++",
            "args": [
                "-Wall",
                "-o",
                "${fileBasenameNoExtension}",
                "-g",
                "${file}",
                "&&",
                "{file}"
  ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}```


Thanks in Advance


0 个答案:

没有答案