Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error finding in QT

In QT-creator I am getting the following error:

ASSERT failure in QVector::operator[]: "index out of range", file c:\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtCore/qvector.h, line 359

My problem is that it does not specify which QVector is out of range... Even when I run in debug mode I cannot find the location of the error. Is there a way to easily find the error? The code is quite huge and the error only pops up every once in a while so it would be a lot of work to check every qVector I use separately.

like image 750
Frank Avatar asked Sep 05 '26 21:09

Frank


1 Answers

Assuming you are using Qt Creator, there is a "Stack" window which shows the function calls which led to the point where your program stopped:

Picture of the Stack Window

In that window, double click the first file which you know is your own file, in that screenshot it is main.cpp in line 5. The file will open and a yellow arrow will be shown. The line which caused the assertion is the line above that yellow arrow (That arrow actually points to the next statement which would have been executed)

like image 158
Tim Meyer Avatar answered Sep 08 '26 01:09

Tim Meyer