一、launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - 生成和调试活动文件",
"type": "cppdbg", // 只能是cppdbg
"request": "launch", // launch:启动,attach:附加
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe", // 需要调试的程序
"args": [], // 调试时传递给程序的参数
"stopAtEntry": false, // 调试时是否停在程序入口:{true:是,false:否}
"cwd": "${workspaceFolder}", // 工作目录
"environment": [], // 额外的环境变量
"externalConsole": true, // true:输出到外部终端;false:只输出到软件终端(有显示不全的可能)
"MIMode": "gdb",
"miDebuggerPath": "D:\\codeblocks-16.01mingw-nosetup\\MinGW\\bin\\gdb.exe", // 调试gdb路径
"setupCommands": [ // 暂时不知道作用
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file" // 预编译任务名称,和tasks.json中的label必须相同
}
]
}
二、task.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
//task1
{
"label": "C/C++: g++.exe build active file", // 任务名称,和launch.json中的preLaunchTask必须相同
"type": "shell",
"command": "g++", // 终端命令
"args": [ // 终端命令附加参数
"${file}",
".\\Point\\point.cpp",
".\\Point\\point.h",
"test.cpp",
"test.h", // 以上是需要编译的源文件和头文件
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",// 编译后的文件名称,和launch.json中的program必须相同
"-g",
"-Wall"
],
"presentation": {
// 未知作用
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
]
}