You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改Code Runner默认命令行以添加g++ -std=c++11参数?

配置Code Runner默认使用C++11标准编译
  • 打开VS Code,按Ctrl+,(Windows/Linux)或Cmd+,(Mac)快速打开设置界面。
  • 在顶部搜索框输入code-runner.executorMap,定位到Code Runner的执行器映射配置项。
  • 点击配置项右侧的编辑 in settings.json按钮,进入配置文件编辑界面。
  • 在settings.json中找到对应C++的配置行,默认内容大致如下:
    "cpp": "g++ $fullFileName -o $fileNameWithoutExt && $fileNameWithoutExt"
    
  • 将该行修改为:
    "cpp": "g++ -std=c++11 $fullFileName -o $fileNameWithoutExt && $fileNameWithoutExt"
    
  • 保存settings.json文件,之后使用Code Runner运行C++代码时,就会默认带上-std=c++11参数编译。

内容的提问来源于stack exchange,提问作者Tanish57

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 23:01:09