博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Windows & Ubuntu Vscode 配置c++环境
阅读量:5076 次
发布时间:2019-06-12

本文共 4368 字,大约阅读时间需要 14 分钟。

背景

被三岁神仙 \(\color{black}{\text{Q}}\color{red}{\text{Y}}\) 使用了rm -rf *(还好有备份)

安装

首先装一个叫做ubuntu make的东西:

sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-makesudo apt-get updatesudo apt-get install ubuntu-make

然后用它

umake web visual-studio-code

中间会有一个询问,输入a+回车

卸载

umake web visual-studio-code --remove

配置中文环境

点一下左边菜单上从上往下第5个(一个方形),查找并安装Chinese (Simplified) Language Pack for Visual Studio Code插件,然后重启vscode

打开一个文件/文件夹

在首页点击打开文件打开文件夹

配置c++环境

安装以下插件:

1516397-20190418104558442-269330693.png

点击左下角的设置图标,点击设置,进入设置页面,再点击右上角的大括号{},进入settings.json的文件,在里面输入:

linux

{  // tab 大小为4个空格  "editor.tabSize": 4,  // 编辑器换行  "editor.wordWrap": "off",  //code runner  "code-runner.executorMap": {    "javascript": "node",    "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",    "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt -Wall && $dir$fileNameWithoutExt", // C 编译命令    "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt -std=c++11 -Wall && $dir$fileNameWithoutExt", // C++ 编译命令    "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"  },  "code-runner.runInTerminal": true, // 让 code runner 在终端中运行程序,code runner 是刚才安装的一个插件,用处是一键编译运行程序,极其方便  //font size  "editor.fontSize": 17 // 默认字体大小}

windows

{  // tab 大小为4个空格  "editor.tabSize": 4,  // 编辑器换行  "editor.wordWrap": "off",  //code runner  "code-runner.executorMap": {    "javascript": "node",    "java": "cd $dir \n javac $fileName \n java $fileNameWithoutExt",    "c": "cd $dir \n gcc $fileName -o $fileNameWithoutExt -Wall \n .\\$fileNameWithoutExt", // C 编译命令    "cpp": "cd $dir \n g++ $fileName -o $fileNameWithoutExt -std=c++11 -Wall \n .\\$fileNameWithoutExt", // C++ 编译命令    "objective-c": "cd $dir \n gcc -framework Cocoa $fileName -o $fileNameWithoutExt \n .\\$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 \n rustc $fileName \n $dir$fileNameWithoutExt",    "racket": "racket",    "ahk": "autohotkey",    "autoit": "autoit3",    "dart": "dart",    "pascal": "cd $dir \n fpc $fileName \n $dir$fileNameWithoutExt",    "d": "cd $dir \n dmd $fileName \n $dir$fileNameWithoutExt",    "haskell": "runhaskell",    "nim": "nim compile --verbosity:0 --hints:off --run",    "lisp": "sbcl --script",    "kit": "kitc --run"  },  "code-runner.runInTerminal": true, // 让 code runner 在终端中运行程序,code runner 是刚才安装的一个插件,用处是一键编译运行程序,极其方便  //font size  "editor.fontSize": 20, // 默认字体大小  "terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"}

编译运行程序

点击右上角的右三角形

更多设置

点击左下角的设置图标,点击设置,进入设置页面,找到你要设置的条目,点击左边的齿轮,复制它的json信息,粘贴到settings.json中。

转载于:https://www.cnblogs.com/BlogOfchc1234567890/p/10728309.html

你可能感兴趣的文章
Mysql性能调优
查看>>
iOS基础-UIKit框架-多控制器管理-实例:qq界面框架
查看>>
自定义tabbar(纯代码)
查看>>
小程序底部导航栏
查看>>
poj1611 简单并查集
查看>>
Ubuntu 14.04下安装CUDA8.0
查看>>
跨平台开发 -- C# 使用 C/C++ 生成的动态链接库
查看>>
C# BS消息推送 SignalR介绍(一)
查看>>
WPF星空效果
查看>>
WPF Layout 系统概述——Arrange
查看>>
PIGOSS
查看>>
软件目录结构规范
查看>>
解决 No Entity Framework provider found for the ADO.NET provider
查看>>
设置虚拟机虚拟机中fedora上网配置-bridge连接方式(图解)
查看>>
ES6内置方法find 和 filter的区别在哪
查看>>
Android实现 ScrollView + ListView无滚动条滚动
查看>>
java学习笔记之String类
查看>>
UVA 11082 Matrix Decompressing 矩阵解压(最大流,经典)
查看>>
硬件笔记之Thinkpad T470P更换2K屏幕
查看>>
iOS开发——缩放图片
查看>>