3

I'm debugging my programs using Code::Blocks and I'm facing following issue: I do not see vector's members in Watches. Why is this happening? How do I deal with it?enter image description here

4
  • What's your actual problem? Presumably, being able to see members of std::vector are a means to an end. Incidently, std::vector doesn't have any public data - only public functions. Commented Jul 14, 2014 at 16:06
  • @enhzflep, I'd like to keep track on vector's members as it's possible in Visual Studio debugging mode Commented Jul 14, 2014 at 18:45
  • 1
    No can do with C::B and GDB. Just use printf/cout. In your code, it seems that you're possible trying to index beyond the bounds of the vector. Dont forget that vector.size() returns the number of elements, the last one is accessed with vector[vector.size()-1]. Since you're accessing both [i] and [i+1], you need to bail if your i ever reaches vector.size() - 2 (I dont know what count holds, it may be something else entirely) - OffTopic: thanks for alerting me that GDB is functional in C::B under windows. Haven't used GDB in over 15 years. :) Commented Jul 14, 2014 at 19:15
  • This is definitely possible with Code Blocks and gdb. Commented May 31, 2015 at 17:30

1 Answer 1

1

You need to install python pretty printers on the gdb version you are using to be able to display the content of vectors correctly, see this link.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.