c - Visual Studio 代码调试 C 请求超时
问题描述
我正在测试VS代码的调试功能。这是我的测试代码:
#include <stdio.h>
int d=100;
int x=200;
int main()
{
printf("d=%d,x=%d\n",d,x);
return 0;
}
这是我在 .vscode 中的 launch.json:
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/main",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
我按了F5,等了好久,没有反应,一直停留在这个状态: enter image description here
很长一段时间后,会出现一个对话框,上面写着“请求超时”。
调试功能以前在我的机器上工作得很好。但我不知道为什么它现在不起作用。所以有人告诉我这里有什么问题吗?
PS:我已经安装了 C/C++ 扩展并在编译时打开了“-g”标志。
解决方案
我解决了这个问题,只是将launch.json中的“externalConsole”从true更改为false,虽然我不知道为什么。如果有人能解释一下,我会很高兴。
推荐阅读
- python-3.x - 获取 Scikit-learn 估计器的最大价值的特征
- meteor - 为什么我的 settings.json 代码在流星中不起作用
- crash - Python-Godot:_input 导致游戏停止运行
- javascript - 从 Fetch api 返回数据以构建 UI
- javascript - 尝试对反应表中的数据进行排序:Reactjs
- r - PSCL 返回 zeroinfl negbin 模型的 NA
- sorting - 对两个文本文件进行排序,其缩进文本与其对齐
- reactjs - 如何从受控自动完成中移除芯片?
- json - 无法使用 sparkDataframe 获取 Json 列:org.apache.spark.sql.AnalysisException:无法解析 'explode;
- firebase - JavaScript 中的 Firebase API 并因此公开,是否关注 Auth?