(一). 下载Vscode shell
(1). 打开Ubuntu软件json
(2). 搜索Vscode,下载并运行.ui
(二). 安装C++spa
(1). 看到右边的列表,点击最下面的3d
(2). 而后咱们搜索和下载 C++ 还有 C++ Intellisense(自动补全)code
(三). 配置orm
(1). 咱们回到欢迎界面,而后选择一个目录(Open folder)blog
(2). 咱们建立一个cpp文件,而且命名为001.cppip
(3). 按下F5,而后选择C++ it
(4). 这个时候会弹出launch.json
(5). 咱们修改这一句
"program": "enter program name, for example ${workspaceFolder}/a.out",
去掉
enter program name, for example
(6)把launch.json关闭,咱们回到001.cpp.
(7) 咱们按下Ctrl + Shift + B ,而后会弹出,而后咱们往下点,最后点Other
(8) 而后在弹出的tasks.json中,咱们修改command项.
"command": "echo Hello"
修改成:
"command": "g++ -g -o a.out ${file}"
(9) 而后咱们就能够关闭 返回001.cpp了。
(10) 咱们按下 Ctrl + Shift + B 编译文件 而后再按下F5运行程序.
最后附上无缺的
launch.json
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/a.out", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }
tasks.json
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "echo", "type": "shell", "command": "g++ -g -o a.out ${file}", "group": { "kind": "build", "isDefault": true } } ] }