C/C++VSCode環境配置
軟件下載地址
VSCode:https://code.visualstudio.com/
MinGW:https://sourceforge.net/projects/mingw/files/latest/download
Dev-C++:https://sourceforge.net/projects/orwelldevcpp/
launsh.json
點擊查看代碼
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"preLaunchTask": "build", //任務命令
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin\\gdb.exe", // 編譯器目錄
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}]
}
tasks.json
點擊查看代碼
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "build",
"command": "C:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
settings.json
點擊查看代碼
{
// "files.defaultLanguage": "cpp", // 默認語言
"editor.mouseWheelZoom": true, // 鼠標放大縮小
"editor.fontSize": 18, // 設置字體大小
"editor.tabSize": 4, // 設置縮進空格寬度
"editor.lineNumbers": "on", // 顯示行號
"editor.formatOnSave": true, // Ctrl+S 保存的同時格式化
"C_Cpp.clang_format_style": "{ BasedOnStyle: Chromium, IndentWidth: 4}", // 左大括號不換行
// "workbench.colorTheme": "Visual Studio Light", // 指定用在工作臺中的顏色主題,白
"workbench.colorTheme": "Visual Studio Dark - C++", // 指定用在工作臺中的顏色主題,黑
// 終端顏色配置
"workbench.colorCustomizations": {
// 可以將鼠標放到下面的色號上根據自己的偏好進行選擇
"terminal.foreground": "#04d331",
"terminal.background": "#000000"
},
"terminal.integrated.fontSize": 18, // 字體大小設置
"workbench.editor.enablePreview": true, //控制打開的編輯器是否顯示為預覽編輯器
}
cpp.json
點擊查看代碼
{
"cpp": {
"prefix": "cpp",
"body": [
"#include<bits/stdc++.h>",
"#define int long long",
"using namespace std;",
"typedef long long ll;",
"const int N=1e6+10, inf=0x3f3f3f3f,inf2=1e18;\n",
"signed main(){",
" freopen(\"1.in\", \"r\", stdin);",
"\n\n\n",
" return 0;",
"}"
]
}
}

浙公網安備 33010602011771號