简体   繁体   中英

How to display the contents of a std::multimap and std::multiset in debugger in QtCreator?

I am trying to inspect the contents of a std::multimap and std::multiset in the Locals and Expressions window of the QtCreator .

Instead of a list of values I get the implementation details displayed.

The strange thing is that the std::map and std::set counterparts are shown fine:

#include <iostream>
#include <map>
#include <set>
#include <string>

int main()
{
    std::multimap<int, std::string> multimap;
    multimap.insert(std::make_pair(1, "one"));
    multimap.insert(std::make_pair(2, "two"));
    multimap.insert(std::make_pair(3, "three"));

    std::multiset<int> multiset = {1,2,3};

    std::map<int, std::string> map;
    map.insert(std::make_pair(1, "one"));
    map.insert(std::make_pair(2, "two"));
    map.insert(std::make_pair(3, "three"));

    std::set<int> set = {1,2,3};

    return 0;
}

在此输入图像描述

I am using:

Qt Creator 3.0.0 
gcc 4.8
GDB 7.6.1
Qt 5.2.0
Ubuntu 13.10

Is this feature supported?

In addition to installing Python libstdc++ printers from https://sourceware.org/gdb/wiki/STLSupport you should also fix them for Ubuntu 13.10.

You should apply this patch http://patchwork.ozlabs.org/patch/287368/ to make them work. See also this answer https://stackoverflow.com/a/21020798/72178 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM