d:/mingw64/bin/
ctrl+shift+x
),搜索Code Runner。Ctrl+Shift+P
,輸入Tasks: Configure Task
,選擇Create tasks.json file from templates
,選擇Others
。F5
就會提示建立。task.json(用於build)html
{ "version": "2.0.0", "tasks": [ { "label": "build hello", "type": "shell", "command": "g++", "args": [ "-g","${file}","-o","${fileDirname}/${fileBasenameNoExtension}.exe" //表明build的是當前文件 ], "group": { //該配置:按ctrl+shift+b就能夠直接build當前文件 "kind": "build", "isDefault": true } } ] }
launch.json(用於調試)shell
{ "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "d:/mingw64/bin/gdb.exe", //mingw的調試程序所在路徑 "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "build hello" //要與tasks.json中的label屬性值同樣 } ] }
塊選擇:Ctrl+Alt+上下左右鍵
行上下移:Ctrl+Shift+上下鍵
刪除行:Ctrl+L
格式化文本:Shift+Alt+F
小代碼塊:Tab
命令面板:Ctrl+Shift+P
並排打開文件:Ctrl+\
json
windows下使用vscode編寫運行以及調試C/C++
C/C++ for Visual Studio Code (Preview)windows