Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Qt:在正常工作的项目上出现断言失败错误_C++_Qt_Visual C++ - Fatal编程技术网

C++ Qt:在正常工作的项目上出现断言失败错误

C++ Qt:在正常工作的项目上出现断言失败错误,c++,qt,visual-c++,C++,Qt,Visual C++,我的项目运行得很好。在bitbucket[bitbucket.org]上更新了我的项目,然后添加了一些评论。再次运行我的项目。奇怪的是,这个错误被给出了 ASSERT failure in QVector<T>::operator[]: "index out of range", file ..\..\include/QtCore/../../src/corelib/tools/qvector.h, line 385 QVector::operator[]:“索引超出范围”,文件.

我的项目运行得很好。在bitbucket[bitbucket.org]上更新了我的项目,然后添加了一些评论。再次运行我的项目。奇怪的是,这个错误被给出了

ASSERT failure in QVector<T>::operator[]: "index out of range", file ..\..\include/QtCore/../../src/corelib/tools/qvector.h, line 385
QVector::operator[]:“索引超出范围”,文件..\\ include/QtCore/./../src/corelib/tools/QVector.h,第385行,断言失败
我想我可能在评论过程中弄糟了一些东西,所以立即查找错误,没有发现任何错误。好吧,我可能错过了什么。因此,登录到bitbucket并下载该项目。删除旧项目并运行新项目。同样的问题,同样的错误。有什么问题吗?我怎样才能从哪里得到这样的错误呢

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //QHBoxLayout *layout=new QHBoxLayout;
    WeekAndDailyView *view=new WeekAndDailyView(this);
    //layout->addWidget(view);
    qDebug()<<"Came here"<<endl;
    setCentralWidget(view);
}
MainWindow::MainWindow(QWidget*父项):
QMainWindow(父级),
用户界面(新用户界面::主窗口)
{
用户界面->设置用户界面(此);
//QHBoxLayout*布局=新的QHBoxLayout;
WeekAndDailyView*视图=新的WeekAndDailyView(此视图);
//布局->添加小部件(视图);

qDebug()签出编辑请检查您所做的更改,您将发现问题的根源您发布的代码中没有明显的QVector。建议仍然有效,在调试器中运行它,并在断言发生时查看堆栈跟踪,然后将堆栈回溯到导致超出范围访问的代码。是否继续说您没有更改任何内容,也没有解决问题?您没有发布足够的代码让任何人看到问题并帮助您,因此您似乎需要做一些工作来跟踪问题。如果您的程序中存在未定义的行为,可能是某些原因使其行为不同。可能是您更改了计算机上其他受影响的内容有些事情,我们不知道,但你可以自己缩小范围,或者提供足够的信息给其他人来帮助你。你是否尝试删除旧的生成目录?有时,当我在现有生成上编译时,像你这样的错误不知从何处出现。我通常通过删除我的生成文件夹或使用“全部清除”和Qt Creator中的“全部重建”命令。
Came here

ASSERT failure in QVector<T>::operator[]: "index out of range", file ..\..\include/QtCore/../../src/corelib/tools/qvector.h, line 385
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
#include "mainwindow.h"
#include <QApplication>
#include <QDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    qDebug()<<"Came Here"<<endl;
    w.show();
    qDebug()<<"Came Here"<<endl;
    return a.exec();
}
Came Here 

ASSERT failure in QVector<T>::operator[]: "index out of range", file ..\..\include/QtCore/../../src/corelib/tools/qvector.h, line 385
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
G:\Programming\Projects\QT try\build-CasePage-Desktop_Qt_5_3_0_MinGW_32bit-Debug\debug\CasePage.exe exited with code 3