【发布时间】:2021-10-18 19:47:53
【问题描述】:
我不知道我的 vscode 突然发生了什么我无法调试文件虽然我要运行我的 CPP 程序但无法调试请帮助我我花了 2-3 个小时连续尝试修复我的调试器
我的程序运行良好,编译器正在创建一个 exe 文件,如下所示
这就像它试图打开外部终端但无法打开它,这就是我认为花了一整天解决这个问题的原因
Lauch.json 文件
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"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": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
}
]
}
任务.json
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: C:\\MinGW\\bin\\g++.exe"
}
]
}
【问题讨论】:
-
看起来你有 Visual Studio Code,而不是 Visual Studio。如果这是您的意图,请继续提问。如果你想使用 Visual Studio,恐怕你下载错了。 Here's the right one
-
到底是什么问题?当您尝试调试时会发生什么?
-
您必须向我们提供更多信息,说明发生了什么以及您采取了哪些步骤来找出原因。您的配置文件看起来不错。
-
可能你无意中激活了程序结束时自动关闭执行窗口的选项?尝试在代码中的某处设置断点,看看是否可以到达它,这将缩小潜在问题的范围。顺便说一句,你在“弹出”上有一个amusing typo ;)
-
@kuroineko no bro that doesn't work 我不知道前天突然发生了什么,它工作得非常好,昨天当我试图调试一个简单的程序时,它只是没有'根本不运行
标签: c++ debugging visual-studio-code terminal