News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How to access array elements during debugging C++?

Started by a6146319, August 18, 2014, 12:38:52 PM

Previous topic - Next topic

a6146319

Hello, I am new to Code::Blocks and have a question in debugging. How I can access array elements during debugging? Things get worse if I cannot access array or matrix elements while using a numerical library, such as eigen. If I create watch, it doesn't show contents or array or matrix.  I read this http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#Script_support link on debugging with Code::Blocks, but couldn't find what I needed. Any help or comments are very welcome.
BTW, I am using GNU GCC compiler, Code::Blocks 13.12 on Windows.

oBFusCATed

1. Right click -> Properties
2. Enable Treat as array
3. Specify start and count
4. Press Ok and you should be able to see your array
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

a6146319

Thanks for your reply. What about if I am using a numerical library such as eigen? Your method does not work there. Is there any different way by which I can extract elements of an array or matrix using eigen (or other) library?

oBFusCATed

It depends on the library. If you're using new enough GDB you can probably write a python pretty printers for the data structures of your library.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]