Inspecting STL containers in Visual Studio 2015(在 Visual Studio 2015 中检查 STL 容器)
问题描述
我运行的是 Visual Studio Enterprise 2015,版本 14.0.23107.0 D14REL.
I'm running Visual Studio Enterprise 2015, version 14.0.23107.0 D14REL.
在调试 C++ 程序时,我看不到 STL 容器的内容.
When debugging a C++ program I cannot see the contents of STL containers.
我已取消选中在变量窗口中显示对象的原始结构"选项(工具->选项->调试->常规).
I've got the "Show raw structure of objects in variables windows" option unchecked (Tools->Options->Debugging->General).
以下是说明问题的示例:
Here's an example that illustrates the problem:
#include <list>
#include <string>
#include <vector>
int main()
{
std::string string = "test";
std::vector<int> vector{ 4, 5, 6 };
std::list<std::string> list{ "one", "two", "three" };
return 0;
}
在 Locals 或 Watch 窗口中,我看到以下内容:
In the Locals or Watch windows I see the following:
list [...]()
vector [...](...
(error) 0
(error) 0
string {npos=4294967295}
(error) 0
(error) 0
如果我然后选中显示原始结构..."选项,我可以正确地深入到向量和字符串对象,但仍然不是列表!
If I then check the "Show raw structure..." option, I can correctly drill down into the vector and string objects, but still not the list!
是否还有其他选项我错过了,或者这是 VS 中的真正错误?
Is there another option that I've missed, or is this a genuine bug in VS?
推荐答案
我遇到了同样的问题.
您需要进入工具->选项->调试->常规并取消选中使用托管兼容模式"和使用本机兼容模式".
You need to go into Tools->Options->Debugging->General and uncheck both "Use Managed Compability Mode" and "Use Native Compability Mode".
这篇关于在 Visual Studio 2015 中检查 STL 容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Visual Studio 2015 中检查 STL 容器
基础教程推荐
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- CString 到 char* 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
