检查Eclipse CDT调试器中std :: vector的内容 [英] Inspecting contents of std::vector in Eclipse CDT debugger
问题描述
有没有方式能够正确调试?
在Eclipse中调试STL容器不是很简单。请查看此问题以及解释原因的答案。对于GDB而言,最简单的方法是这个答案,可以总结如下:
在变量视图中展开您的向量,您应该找到一个嵌套变量 _M_start
。右键单击,选择显示为数组...并输入所需的范围。然后,元素应显示嵌套在 _M_start
下。
I'm using Eclipse with the CDT plugin to develop in C++. I'm also using std library to create vectors and I am having an issue while debugging: Eclipse does not allow me to view the content of the vectors.
Is there any way to be able to debug it properly?
Debugging STL containers in Eclipse is not quite straightforward. Please have a look at this question and the answers explaining the reasons for this. The simplest way without fiddling with the GDB for me is this answer, which can be summarized as follows:
Expand your vector in the variable view, you should find a nested variable _M_start
. Right-click, choose "Display As Array..." and enter the desired range. The elements should then show up nested under _M_start
.
这篇关于检查Eclipse CDT调试器中std :: vector的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!