c - 用于编译和运行 .c 文件的 Visual Studio Code 任务
问题描述
如何在 Visual Studio Code(最新版本)中创建任务来编译和运行 .c 文件。
我在网上找到了这个:
"version": "2.0.0",
"tasks": [
{
"label": "compile and run C",
"type": "shell",
"command": "(gcc -g ${file} -o ${fileBasenameNoExtension}) -and (./${fileBasenameNoExtension})",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
我设法对其进行了调整,但它仍然不会同时编译和运行,而是得到了这个:
> Executing task: (gcc -g d:\ISEP\ARQCP\partilha\arqcp19202deg01\pl0_7.c -o pl0_7) -and (./pl0_7) <
False
Terminal will be reused by tasks, press any key to close it.
有什么方法可以使用简单的快捷方式编译和运行我的代码(目前我按 CTRL+SHIFT+B 来“编译并运行”)?
解决方案
所以我一直在寻找一种方法来做到这一点,我发现了这个简单的扩展:Code Runner。
基本上,它只是为大多数编码语言添加了一个运行代码按钮,它使它变得如此容易。
推荐阅读
- c - libc 包含不遵守源类型参数更改的守卫
- java - 当使通知不可关闭时,使用这些解决方案有什么区别?
- c++ - 将 const* 存储在 const 向量中
- mongodb - mongodb ops manager 头部数据库
- microsoft-graph-api - 有没有办法轮询团队卡中的点击按钮?
- excel - 下拉姓名列表,选择姓名,将人员的信息行从一张表复制并粘贴到另一张表
- node.js - Actions On Google 的帐户关联响应在印地语中不正确
- flutter - 在颤振中,如何让有状态的小部件/状态知道新数据可用并且需要重建?
- angular - 带 Angular 的 Ionic 4:有可用的升级指南吗?
- excel - Excel:如果匹配两个表格的单元格,写是