Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual C++ 2010 vector debug - no contents shown

When I try to access a vector in the VC++ 2010 debugger, the only available elements are "_M_start", "_M_end", and "_M_end_of_storage". An example screenshot as follows:

Vector debug issue example

I remember a while back being able to access the actual contents of a vector, but for a long time this has not been the case (I've been able to live with it for a while). Is there a particular setting/feature that I've accidentally turned off or am I missing something completely?

like image 289
Alex Z Avatar asked Nov 04 '22 08:11

Alex Z


1 Answers

It is known that VS IDE can't display debug information of STL containers which are not Microsoft owned STL. i had the same issue while using STLPort library.

but, you can still use the watch to explore the vector's content, it would just be more tedious. You can access the vector's elements by using an array indexing approach over the _M_start member. Add to your watch

meshEdges._M_start[0]

You'll then be able to see the content of first element of the vector. There is no simple way to explore/view the entire vector's elements, you'll have to iterate it yourself, but it is still something.

You can read more in this link http://umairsaeed.com/2009/11/23/visualizing-stlport-data-structures-in-visual-studio-debugger . It describes how to add the above "knowledge" to the VS IDE Watch component. I'm not sure it is up to date to your VS2010 compiler, but you can explore yourself.

like image 177
NirMH Avatar answered Nov 10 '22 16:11

NirMH