(一). 下載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 } } ] }