在Visual Studio 2015中检查STL容器 [英] Inspecting STL containers in Visual Studio 2015
问题描述
我正在运行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;
}
在本地或观察窗口中,我看到以下内容:
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容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!