vscode gdb终端一闪而过
时间: 2023-09-21 15:14:06 浏览: 214
在VSCode中,如果在调试过程中终端窗口一闪而过,可以通过以下几个步骤解决此问题。
首先,打开你的`launch.json`文件。你可以通过按下`Ctrl + Shift + P`,然后输入"launch.json"并选择"Edit Configuration (launch.json)"来打开该文件。
在`launch.json`文件中,找到你的配置,在`setupCommands`字段中添加如下两行代码:
```
{
"description": "等待用户输入",
"text": "getchar()",
"ignoreFailures": true
},
```
或者
```
{
"description": "等待用户输入",
"text": "system(\"pause\")",
"ignoreFailures": true
},
```
这样,在执行完程序后会等待用户输入任意字符,避免终端窗口一闪而过。
接下来,打开你的`tasks.json`文件。你可以通过按下`Ctrl + Shift + P`,然后输入"tasks.json"并选择"Configure Default Build Task"来打开该文件。
在`tasks.json`文件中,找到你的配置,在`command`字段中修改为你的mingw-w64下的gcc.exe目录,例如:
```
"command": "E:\\software\\mingw-w64\\mingw64\\bin\\gcc.exe",
```
保存并关闭文件。
这样,当你在VSCode中进行调试时,终端窗口将不再一闪而过,并在程序执行完毕后等待用户输入,方便查看程序输出结果。
阅读全文
相关推荐


















