- 添加 debug 配置
![]()
会生成以文件 CppProperties.json:
{
"configurations": [
{
"inheritEnvironments": [
"msvc_x64"
],
"name": "x64-Debug",
"includePath": [
"${env.INCLUDE}",
"${workspaceRoot}\\**"
],
"defines": [
"WIN32",
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "windows-msvc-x64"
}
]
}
- 定义构建任务的过程:
![]()
生成文件 tasks.vs.json:
{
"version": "0.2.1",
"tasks": [
{
"taskLabel": "任务-main",
"appliesTo": "main.cpp",
"type": "launch",
"command": "cl",
"args": [
"/EHsc",
"/utf-8",
"/MTd",
"/Zi", // 生成完整的调试信息
"main.cpp"
]
}
]
}
- 创建调试任务:
![]()
生成文件 launch.vs.json:
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "native",
"name": "main.exe",
"project": "main.exe",
"projectTarget": ""
}
]
}
- 选择调试目标:
![]()
打断点:

- 调试的完整过程:
![]()





浙公网安备 33010602011771号