search

Home  >  Q&A  >  body text

visual-studio-code - vscode配置c/c++怎么让编译之后立刻运行?

只是想编译之后立刻运行,像sublime那样从文件读入后输出到下面控制台。
写了个tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "tasks": [
        {
            "taskName": "build",
            "command": "g++",
            "isShellCommand": true,
            "args": [
                "-o",
                "${workspaceRoot}/main",
                "${workspaceRoot}/main.cpp"
            ],
            "showOutput": "always"
        },
        {
            "taskName": "run",
            "command": "${workspaceRoot}/main",
            "isShellCommand": true,
            "showOutput": "always"
        }
    ]
}

为啥,第二个任务不会运行。。

高洛峰高洛峰2805 days ago625

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 15:27:32

    Now VS Code tasks will not be executed continuously.

    Solution:

    1. Use external tools, such as scripting, msbuild, make, etc.

    2. Configure debugging without adding breakpoints. After compiling, press F5 to run

    Updated on 2017-03-02:

    VS Code 1.10 supports combining multiple tasks, and you can also set shortcut keys for a single task.

    reply
    0
  • Cancelreply