vscode 编辑器配置c/c++
vscode 使用笔记
vscode 常用插件:
code runner :支持快捷执行
Visual Studio IntelliCode:智能代码提示
prettier-code formatter:代码格式化 ,win下快捷键为shift+alt+F
launch.json 文件配置 { "version": "0.2.0", "configurations": [ { "name": "gcc.exe build and debug active file", "type": "cppdbg", "request": "launch", // "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "program": "${workspaceFolder}\\build\\${fileBasenameNoExtension}.exe", // 配置生成EXE文件路径,将EXE文件保存到单独的build文件夹 "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "D:\\ProgramFile\\mingw64\\bin\\gdb.exe", // mingw64 安装位置 "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "gcc.exe build active file" } ] } tasks.json 文件配置 { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "type": "shell", "label": "g++.exe build active file", "command": "D:\\ProgramFile\\mingw64\\bin\\g++.exe", "args": [ "-g", "${file}", "-o", // "${fileDirname}\\${fileBasenameNoExtension}.exe" "${workspaceFolder}\\build\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "D:\\ProgramFile\\mingw64\\bin" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true } } ] }