c_cpp_properties.json:
{
"version": 4,
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"macFrameworkPath": [
"/library/developer/commandlinetools/library/frameworks" //(主要)
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools"
}
]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "clang++ - Build and debug active file", // 配置名称
"type": "lldb", // 配置类型
"request": "launch", // 请求配置类型,launch或者attach
"program": "${workspaceFolder}/build/ProjectName", // 进行调试程序的路径(主要)
"args": [], // 传递给程序的命令行参数,一般为空
"cwd": "${workspaceFolder}", // 项目目录
"preLaunchTask": "clang++ build active file" //每次调试前会自动编译
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang++ build active file", //任务名
"command": "cd ./build ;cmake ../ ;make", //编译命令,更改(主要)
"args": [],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}