Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
217 views
in Technique[技术] by (71.8m points)

c++ - Inspecting STL containers in Visual Studio 2015

I'm running Visual Studio Enterprise 2015, version 14.0.23107.0 D14REL.

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!

Is there another option that I've missed, or is this a genuine bug in VS?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had a same problem.

You need to go into Tools->Options->Debugging->General and uncheck both "Use Managed Compability Mode" and "Use Native Compability Mode".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...