如何修改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
相关产品推荐
相关产品推荐

