本文json来自 https://zhuanlan.zhihu.com/p/77645306
安装Mingw-w64,打开cmd,输入gcc -v
,测试是否安装成功。
新建文件夹.vscode
,新建launch.json
和tasks.json
。
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "gdb.exe",
"preLaunchTask": "compile",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
},
]
}
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "compile",
"command": "g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Comments 2 条评论
我之前都用DevCPP
@前端练习生 DevCpp比较省事,但感觉界面不如VSCode