检查Eclipse CDT调试器中std :: vector的内容 [英] Inspecting contents of std::vector in Eclipse CDT debugger

查看:207
本文介绍了检查Eclipse CDT调试器中std :: vector的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse与CDT插件开发C ++。我也使用std库创建向量,我在调试时遇到问题:Eclipse不允许我查看向量的内容。



有没有方式能够正确调试?

解决方案

在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆