小编age*_*ada的帖子

漂亮的地图打印机抛出类型错误

我使用http://wiki.eclipse.org/CDT/User/FAQ#How_can_I_inspect_the_contents_of_STL_containers.3F配置了漂亮的打印机.它成功地适用于矢量和其他容器.但是我无法检查地图,如下例所示:

#include <map>
#include <iostream>

using namespace std;

int main ()
{
map <int, string> mapIntToString;
map <int, int> mapInt2;
 mapIntToString.insert (map <int, string>::value_type (3, "Three"));
 mapInt2.insert (map <int, int>::value_type (3, 4));
 return 0;
}
Run Code Online (Sandbox Code Playgroud)

使用gdb打印时出现以下错误:

(gdb) p mapInt2
$1 = std::map with 1 elementsTraceback (most recent call last):
File "/home/myuser/opt/gdb_printers/python/libstdcxx/v6/printers.py", line 422, in    children
rep_type = find_type(self.val.type, '_Rep_type')
File "/home/myuser/opt/gdb_printers/python/libstdcxx/v6/printers.py", line 45, in    find_type
 raise ValueError, "Cannot find type %s::%s" % (str(orig), name)
ValueError: Cannot find type …
Run Code Online (Sandbox Code Playgroud)

c++ python gdb pretty-print

6
推荐指数
2
解决办法
3425
查看次数

标签 统计

c++ ×1

gdb ×1

pretty-print ×1

python ×1