windows环境,mac也有后面再上传
VSCode、mingw32(gccg++gdb)、c/c++扩展
- 正常调试,没毛病
- 在 .vscode 文件夹中共4个文件
c_cpp_properties.json
setting.json
launch.json
tasks.json
c_cpp_properties.json
主要是标准库路径,要不要改与你安装的编译器路径有关,我这里当然是默认的安装文件路径啦
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"c:/mingw/include.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
//"**/.vscode": true,
"***.out": true,
},
"code-runner.ignoreSelection": true,
"markdown.preview.fontSize": 20,
"C_Cpp.errorSquiggles": "Disabled"
}
launch.json
主要是调试文件,这里也与MinGW_gdb路径有关,只有一条,其他的直接copy
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch", // 配置名称,将会在启动配置的下拉菜单中显示
"preLaunchTask": "g++.exe build active file",
"type": "cppdbg",//只能为cppdbg
"request": "launch",
"program": "${fileDirname}\${filebasenameNoExtension}.exe",//调试程序的路径名称
"args": [], 程序调试时传递给程序的命令行参数,一般设为空即可
"stopAtEntry": false, // 设为true时程序将暂停在程序入口处,一般设置为false
"cwd": "${workspaceFolder}", // 调试程序时的工作目录,一般为${workspaceFolder}即代码所在目录
"environment": [],
"externalConsole": true, // 调试时是否显示控制台窗口,一般设置为true显示控制台
"MIMode": "gdb",
"miDebuggerPath": "C:/MinGW/bin/gdb.exe", // miDebugger的路径,注意这里要与MinGw的路径对应
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
task.json
主要是编译链接设置,注意两条g++、bin路径即可,其余直接copy
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "g++.exe build active file",
"command": "C:/MinGW/bin/g++.exe",
"args": [ // 编译命令参数
"-g",
"${file}",
"-o",
"${fileDirname}\${filebasenameNoExtension}.exe"
],
"options": {
"cwd": "C:/MinGW/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}



