Qt:在运行完美的项目上给出断言失败错误

问题描述 投票:0回答:1

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

ASSERT failure in QVector<T>::operator[]: "index out of range", file ..\..\include/QtCore/../../src/corelib/tools/qvector.h, line 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);
}

应用程序输出:

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.

更奇怪的是,我的 main.cpp:

#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

注意:我在 Windows 上的 Qt 5.2.1(MSVC 2010,32 位)上使用 Qt 3.1.1 Absed。我只安装了一个 MinGW。而且我已经重新启动机器并重新安装了Qt。

c++ qt visual-c++
1个回答
0
投票

你找到解决办法了吗?面临同样的问题。

© www.soinside.com 2019 - 2024. All rights reserved.