在 VSCode 中只看到调试 C++ 的局部变量 [英] Seeing only local variables debugging C++ in VSCode

查看:30
本文介绍了在 VSCode 中只看到调试 C++ 的局部变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Visual Studio Code,并且在调试时(我正在调试用 Clang 编译的 C++ 代码)我只看到局部变量.我没有看到任何全局变量列表.

I am using Visual Studio Code and when I debug (I am debugging C++ code compiled with Clang) I see only local variables. I do not see any global variables list.

如何查看所有变量?

在这种情况下,我在一个循环中,我只看到循环内部定义的所有变量,而不是外部定义的变量.

In this case I am inside a loop and I see only all the variables defined inside the loop, not the one defined outside.

推荐答案

您需要手动将全局变量添加到监视窗口.

You will need to manually add global variables to a watch window.

  1. 设置断点
  2. 开始调试(调试 -> 开始调试或F5)
  3. 打开一个观察窗口(调试 -> 窗口 -> 观察 -> 观察 1)
  4. 手动输入变量名

这篇关于在 VSCode 中只看到调试 C++ 的局部变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆