问题描述
只是想编译之后立刻运行,像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'} ]}
为啥,第二个任务不会运行。。
问题解答
回答1:现在VS Code的任务是不会连续执行的。
解决方法:
利用外部工具,例如写脚本、msbuild、make等等
配置调试,不加断点,编译后再按F5运行
2017-03-02更新:
VS Code 1.10支持组合多个任务了,也可以给单个任务设快捷键。