Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. C++ program debugged well with Cygwin4 (under Netbeans 7.2) but not with MinGW (under QT 4.8.1)
Forum Update on Tuesday, May 27th 2025

C++ program debugged well with Cygwin4 (under Netbeans 7.2) but not with MinGW (under QT 4.8.1)

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GoldenAxe
    wrote on 23 Oct 2012, 06:30 last edited by
    #1

    I have a c++ program that takes a map text file and outputs it to a graph data structure I have made. I am using QT as I needed cross-platform program and GUI as well as visual representation of the map. I have several maps in different sizes (8x8 to 4096x4096). I am using unordered_map with a vector as key and vertex as value, I'm sending hash(1) and equal functions which I wrote to the unordered_map in creation.

    Under QT I am debugging my program with QT 4.8.1 for desktop MinGW (QT SDK), the program works and debugs well until I try the largest map of 4096x4096, then the program gets stuck with the following error: "the inferior stopped because it received a signal from operating system". When debugging, the program halts at the hash function which used inside the unordered_map and not as part of the insertion state, but at a getter(2).

    Under Netbeans IDE 7.2 and Cygwin4 all works fine (debug and run).

    Some code info:
    @typedef std::vector<double> coordinate;
    typedef std::unordered_map<coordinate const*, Vertex<Element>*, container_hash, container_equal> vertexsContainer;
    vertexsContainer *m_vertexes
    @

    (1) hash function:
    @struct container_hash
    {
    size_t operator()(coordinate const *cord) const
    {
    size_t sum = 0;
    std::ostringstream ss;

        for ( auto it = cord->begin() ; it != cord->end() ; ++it )
        {
           ss << *it;
        }
    
        sum = std::hash<std::string>()(ss.str());
        return sum;
    }
    

    };@

    (2) the getter:
    @template <class Element>
    Vertex<Element> *Graph<Element>::getVertex(const coordinate &cord)
    {
    try
    {
    Vertex<Element> *v = m_vertexes->at(&cord);
    return v;
    }
    catch (std::exception& e)
    {
    return NULL;
    }
    }@

    • I was thinking maybe it was some memory issue at the beginning, so before I was thinking of trying Netbeans I checked it with QT on my friend pc with a 16GB RAM and got the same error.

    Update: I try to run this on visual studio 2012, I got a bad_alloc error which halt my program, when looking at task manager I saw the memory assigned to the program was going up to 2GB, could be it's because it's a 32bit program?

    Update: I debugged my program under Netbeans with 32bit architecture and Cygwin4 and all worked fine, so maybe it is not a 32 bit problem, also the memory used with netbeans was 1.5GB, so how in MinGW and VS2012 it's going up to 2GB?

    Thanks.

    1 Reply Last reply
    0

    1/1

    23 Oct 2012, 06:30

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved