使用vscode时想要调试,网上所有办法几乎都试过了,调试文件“launch.json”也没有错误,却一直弹这个弹窗:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "D:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "D:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe 生成活动文件"
}
]
}
windows7 vscode MinGW
各种方法几乎都用过了
希望能成功调试,谢谢
目前我们并不能对代码进行调试,要想进行调试需要创建aunch.json文件,同理也不需要我们自己创建,可以选择在调试界面选择“创建launch.json文件”,或者在菜单栏中选择调试 > 添加配置.,然后选择C ++(GDB / LLDB),然后选择g++.exe build and debug active file.
然后在launch.json文件中写下如下内容:
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "D:\\MinGW\\bin\\gdb.exe", //更改到自己的目录下
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "g++.exe build active file"
}
]
}
完成上述事情之后就可以设置断点进行相对应的调试了
代码不要放在 onedrive 的桌面上,放在本地看看