c++ program debugged well with Cygwin4 (under Netbeans 7.2) but not with MinGW (under QT 4.8.1)
Posted
by
GoldenAxe
on Stack Overflow
See other posts from Stack Overflow
or by GoldenAxe
Published on 2012-10-22T22:57:02Z
Indexed on
2012/10/22
23:00 UTC
Read the original article
Hit count: 157
I have a c++ program which take a map text file and output 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 debug well until I try the largest map of 4096x4096, then the program stuck with the following error: "the inferior stopped because it received a signal from operating system", when debugging, the program halt 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.
Thanks.
© Stack Overflow or respective owner