gpt4 book ai didi

c - 编译后立即在cmd上运行程序(vscode上的Code Runner插件)

转载 作者:行者123 更新时间:2023-11-30 16:06:56 26 4
gpt4 key购买 nike

我安装了 Code Runner 来编译我的 C 代码。我希望在编译程序后,.exe 将直接在我的 cmd 上打开,就像 Visual Studio 的工作方式一样。

我怎样才能做到这一点?

最佳答案

正如marketplace中提到的那样

转到 VS Code > 首选项:

  • 然后输入:Code Runner

Code Runner

您将看到Code-Runner: Executor-Map,点击在settings.json中编辑,您将看到如下内容:

{
"window.zoomLevel": 0,
"C_Cpp.updateChannel": "Insiders",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"workbench.iconTheme": "material-icon-theme",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.configuration.checkProjectSettingsExclusions": false,
"explorer.confirmDelete": false,
"javascript.updateImportsOnFileMove.enabled": "always",
"explorer.confirmDragAndDrop": false
}

然后在"explorer.confirmDragAndDrop": false下面添加此内容,如下所示:

{
"window.zoomLevel": 0,
"C_Cpp.updateChannel": "Insiders",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"workbench.iconTheme": "material-icon-theme",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.configuration.checkProjectSettingsExclusions": false,
"explorer.confirmDelete": false,
"javascript.updateImportsOnFileMove.enabled": "always",
"explorer.confirmDragAndDrop": false,
"code-runner.executorMap": {
"javascript": "nodejs",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && start $dir$fileName"
}
}

恭喜:)

关于c - 编译后立即在cmd上运行程序(vscode上的Code Runner插件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59811507/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com