我运行的是 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 容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
读取输入文件,最快的方法?read input files, fastest way possible?(读取输入文件,最快的方法?)
在 C++ 中读取格式化输入的最简单方法?The easiest way to read formatted input in C++?(在 C++ 中读取格式化输入的最简单方法?)
从 .txt 文件读取到 C++ 中的二维数组Reading from .txt file into two dimensional array in c++(从 .txt 文件读取到 C++ 中的二维数组)
如何在 C++ 中模拟按键按下How to simulate a key press in C++(如何在 C++ 中模拟按键按下)
为什么在 cin.ignore() 之后没有 getline(cin, var) 读取Why doesn#39;t getline(cin, var) after cin.ignore() read the first character of the string?(为什么在 cin.ignore() 之后没有 getline(cin, var) 读取
scanf 格式输入的 cin 类比是什么?What is the cin analougus of scanf formatted input?(scanf 格式输入的 cin 类比是什么?)