vscode 通过 coderunner 配置C++ 编译环境 (更新版 2019/6/7)

您所在的位置:网站首页 coderunner怎么输入 vscode 通过 coderunner 配置C++ 编译环境 (更新版 2019/6/7)

vscode 通过 coderunner 配置C++ 编译环境 (更新版 2019/6/7)

2023-04-03 12:29| 来源: 网络整理| 查看: 265

如题使用coderunner来配置C++ 编译环境

首先我们需要一个vscode

这就是废话啊

那么vscode是有对应所需要的插件的

所需的插件如下:

这个使用请使用cmd,判断一下环境变量path是否有g++

出现以上界面即有对应的g++环境变量,如果没有的话,推荐可以先下载一个codeblocks,然后打开codeblocks的安装文件,可以得到一个

然后获取其对应的地址C:\Program Files (x86)\CodeBlocks\MinGW\bin\

再打开

添加刚刚得到的路径名即可C:\Program Files (x86)\CodeBlocks\MinGW\bin\

然后打开cmd控制台,输入g++ -v判断是否成功

成功就可以下一步了

ctrl + shift + p

打开setting,可见以下界面

然后在搜索框里查找,一下两个属性,将其修改成为true即可

 "code-runner.runInTerminal": true,

"code-runner.ignoreSelection": true,

 

如下

另一个属性同理

改完后就ok了,就能拿vscode写Cpp了

 

【注】:更新vscode的版本后,这样的配置出现了问题

所以我们来搞定问题,使用shift + control + p

 

 然后进入界面,查找code-runner.executorMap

然后

添加

"code-runner.executorMap":{ "javascript": "node", "java": "cd $dir ; javac $fileName ; java $fileNameWithoutExt", "c": "cd $dir ; gcc $fileName -o $fileNameWithoutExt ; $dir$fileNameWithoutExt", "cpp": "cd $dir ; g++ $fileName -o $fileNameWithoutExt ; ./$fileNameWithoutExt", "objective-c": "cd $dir ; gcc -framework Cocoa $fileName -o $fileNameWithoutExt ; $dir$fileNameWithoutExt", "php": "php", "python": "python -u", "perl": "perl", "perl6": "perl6", "ruby": "ruby", "go": "go run", "lua": "lua", "groovy": "groovy", "powershell": "powershell -ExecutionPolicy ByPass -File", "bat": "cmd /c", "shellscript": "bash", "fsharp": "fsi", "csharp": "scriptcs", "vbscript": "cscript //Nologo", "typescript": "ts-node", "coffeescript": "coffee", "scala": "scala", "swift": "swift", "julia": "julia", "crystal": "crystal", "ocaml": "ocaml", "r": "Rscript", "applescript": "osascript", "clojure": "lein exec", "haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt", "rust": "cd $dir ; rustc $fileName ; $dir$fileNameWithoutExt", "racket": "racket", "ahk": "autohotkey", "autoit": "autoit3", "dart": "dart", "pascal": "cd $dir ; fpc $fileName ; $dir$fileNameWithoutExt", "d": "cd $dir ; dmd $fileName ; $dir$fileNameWithoutExt", "haskell": "runhaskell", "nim": "nim compile --verbosity:0 --hints:off --run", "lisp": "sbcl --script", "kit": "kitc --run" }, 然后就ok了   PS:如果还是错误,请在留言板留言


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3