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 容器


基础教程推荐
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 常量变量在标题中不起作用 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01