C++ debugging tip(for gcc and STL)

I want to wrote this tip down for me,to find it when i forget the details and for others that are searcing for it.

So if you are using STL containers like a vector,some strange errors errors can appear if you use an out of range index to the container. If you use .at() method then you are safe ,but you used [] in a lot of places and you can use the flag -D_GLIBCXX_DEBUG to use a safe STL container that will check and will find this errors.

The problem with this errors is theat the program will crash usualy in other place not in the place were the bug is. In my case the program crashed in the ~vector destructor. Read on google about using this flags have some problems(the important one is that you must rebuild all the parts that interoperate with STL containers).

To add this flag in a Qt project you need to add this line in the .pro file

QMAKE_CXXFLAGS +=-D_GLIBCXX_DEBUG1

Educational software

I have a 3 and 1/2 years old boy, I learned him to se the mouse and the arrow keys to play some basic games. To help him learn to count I created a little game named Learn to count,written in c++ and Qt. My son knows the symbols “1”,”2″,…”10″ and it knows to count correctly but it is harder for him to count objects. So if you put him to count some objects he will fail sometimes. Using this game he can practice this and practice the use of the mouse.

I used sourceforge.net to host the project,it was my first time i used it so i had some problems getting used to it.

The application is posted to qt-apps.org

The application is licensed under GPL v3 , the art was made by my wife Cristina, and I thank her for the help.