vendredi 2 décembre 2016

QVector crashes while pushing elements into it

QVector crashes while push_back() ing the elements.

After debugging i found that QVector already contain elements saying "cxx0030: error expression cannot be evaluated"

test_subject_02.cpp

#include "test_subject_02.h"

TEST_SUBJECT_02::TEST_SUBJECT_02(QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags)
{
    ui.setupUi(this);
    wv->set_tCH_tCL_avg();// wv is declared in .h file and is the object of class waveform

}

TEST_SUBJECT_02::~TEST_SUBJECT_02()
{

}

waveform.h

#ifndef WAVEFORM_H
#define WAVEFORM_H

#include <qvector.h>

class waveform
{

public:
    waveform();
    void set_tCH_tCL_avg();
    ~waveform();

private:
        QVector <double> tCH_vec;
};

#endif // WAVEFORM_H

waveform.cpp

#include "waveform.h"
#include<qvector.h>

waveform::waveform()
{

}

void waveform::set_tCH_tCL_avg()
{
   double t=0.9;
   tCH_vec.push_back(t);\\ Gives error
}

waveform::~waveform()
{

}

Aucun commentaire:

Enregistrer un commentaire