PDA

View Full Version : Weird bug related to QtGui4.dll and Qwt



Momergil
8th March 2013, 19:53
Hello!

Some time ago I developed a software that should monitor app's ram memory consumption. Lately I decided to add internal graphs using Qwt and till now everything run fine.

After many tests opening the software inside Qt Creator, I created a installable version usnig Inno and when I try to execute it, a strange message appears:

The procedure entry point _ZN14QWindowSurfaceC2EP7QWidget could not be located in the dynamic link library QtGui4.dll.

This problem is making me unable to use the software outside Qt creator.

A second problem also arrised, now related to Qwt I think:

when I first tried to execute my app, Windows sad that the QtOpenGL4.dll (or something like) was missing. The problem is that while I'm using Qwt to plot a simplw QwtPlot, I'm using nothing of OpenGL. Not sure if one has to do with the other, but in any case, I'm mentioning it.



Thanks,

Momergil

amleto
8th March 2013, 20:51
you made a mistake creating the installable version.

Momergil
12th March 2013, 19:25
you made a mistake creating the installable version.

Sorry, no way. I use the same installator as always, only changing things such as the name of the app, file locations, etc.. And the software's intallable version itself is the same that is running inside Qt.

Notice that during compilation mingw reports:


c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.

Added after 25 minutes:

Correction: I did some research comparing to older versions of my software and I found that the problem is in the function that plot the graph:

Note: MReadWrite is a convenience class for file manipulation.
SAFEDELETE === delete



MReadWrite *mrw = new MReadWrite(this);

if (!mrw->openRead(QDir::currentPath() + "/Log_RAM_10.log"))
{
QMessageBox::warning(this,"Erro","Falha ao abrir grafico.");
SAFEDELETE(mrw);
return;
}
else
{
QVector<double> xPoints, data_emuso, data_disponivel, data_servidor, data_central, data_mysql, data_http1, data_http2;
double xCounter = 0.0;
int linhaCounter = 0, ultimoTracejado = 0;

// Header localizer
while (!mrw->isAtEnd())
{
linhaCounter++;

const QString linha = mrw->readLine();

if (linha.contains("------------------------------------------------"))
ultimoTracejado = linhaCounter;
}

mrw->goToLine(ultimoTracejado + 2);

while (!mrw->isAtEnd())
{
const QString linha = mrw->readLine();

data_emuso.append(linha.section("\t",2,2).toDouble());
data_disponivel.append(linha.section("\t",3,3).toDouble());
data_servidor.append(linha.section("\t",5,5).toDouble());
data_central.append(linha.section("\t",6,6).toDouble());
data_mysql.append(linha.section("\t",7,7).toDouble());
data_http1.append(linha.section("\t",8,8).toDouble());
data_http2.append(linha.section("\t",9,9).toDouble());

xPoints.append(xCounter++);
}

mrw->closeFile();
SAFEDELETE(mrw);

if (!data_emuso.isEmpty() && !data_disponivel.isEmpty() && !data_servidor.isEmpty() && !data_central.isEmpty()
&& !data_mysql.isEmpty() && !data_http1.isEmpty() && !data_http2.isEmpty())
{
QDialog *graphWindow = new QDialog(this);
graphWindow->setFixedSize(800,400);
graphWindow->setWindowTitle("Gráfico (base: 10 min)");

QWidget *graphWidget = new QWidget(graphWindow);
graphWidget->resize(graphWindow->size());

QwtPlot *plot = new QwtPlot(graphWidget);
plot->resize(plot->parentWidget()->size());
plot->setAxisScale(QwtPlot::xBottom,0.0,xPoints.last());
plot->setAxisTitle(QwtPlot::xBottom,"Amostras");
plot->setAxisTitle(QwtPlot::yLeft,"Valor (MByte)");
plot->setAxisScale(QwtPlot::yLeft,0.0,4096.0);
plot->setCanvasBackground(QBrush(Qt::white));

QwtPlotCurve *curva_emuso = new QwtPlotCurve("curva_emuso");
curva_emuso->attach(plot);
curva_emuso->setPen(QPen(Qt::red,2.0));
curva_emuso->setSamples(xPoints,data_emuso);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true );
curva_emuso->show();

QwtPlotCurve *curva_disponivel = new QwtPlotCurve("curva_disponivel");
curva_disponivel->attach(plot);
curva_disponivel->setPen(QPen(Qt::gray,2.0));
curva_disponivel->setSamples(xPoints,data_disponivel);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true );
curva_disponivel->show();

QwtPlotCurve *curva_servidor = new QwtPlotCurve("curva_servidor");
curva_servidor->attach(plot);
curva_servidor->setPen(QPen(Qt::blue,2.0));
curva_servidor->setSamples(xPoints,data_servidor);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true );
curva_servidor->show();

QwtPlotCurve *curva_central = new QwtPlotCurve("curva_central");
curva_central->attach(plot);
curva_central->setPen(QPen(Qt::green,2.0));
curva_central->setSamples(xPoints,data_central);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true );
curva_central->show();

QwtPlotCurve *curva_mysql = new QwtPlotCurve("curva_mysql");
curva_mysql->attach(plot);
curva_mysql->setPen(QPen(Qt::cyan,2.0));
curva_mysql->setSamples(xPoints,data_mysql);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true );
curva_mysql->show();

QwtPlotCurve *curva_http1 = new QwtPlotCurve("curva_http1");
curva_http1->attach(plot);
curva_http1->setPen(QPen(Qt::yellow,2.0));
curva_http1->setSamples(xPoints,data_http1);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true );
curva_http1->show();

QwtPlotCurve *curva_http2 = new QwtPlotCurve("curva_http2");
curva_http2->attach(plot);
curva_http2->setPen(QPen(Qt::darkYellow,2.0));
curva_http2->setSamples(xPoints,data_http2);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true );
curva_http2->show();

plot->replot();
plot->show();
graphWindow->exec();

SAFEDELETE(curva_emuso);
SAFEDELETE(curva_disponivel);
SAFEDELETE(plot);
SAFEDELETE(graphWindow);
}
}


Added after 42 minutes:

Ok, I think is a Qwt problem... I managed to change the function to the following code and the problem don't appear:



MReadWrite *mrw = new MReadWrite(this);

if (!mrw->openRead(QDir::currentPath() + "/Log_RAM_10.log"))
{
QMessageBox::warning(this,"Erro","Falha ao abrir grafico.");
SAFEDELETE(mrw);
return;
}
else
{
QVector<double> xPoints, data_emuso, data_disponivel, data_servidor, data_central, data_mysql, data_http1, data_http2;
double xCounter = 0.0;
int linhaCounter = 0, ultimoTracejado = 0;

// Localiza ponto de inicio
while (!mrw->isAtEnd())
{
linhaCounter++;

const QString linha = mrw->readLine();

if (linha.contains("------------------------------------------------"))
ultimoTracejado = linhaCounter;
}

mrw->goToLine(ultimoTracejado + 2);

while (!mrw->isAtEnd())
{
const QString linha = mrw->readLine();

data_emuso.append(linha.section("\t",2,2).toDouble());
data_disponivel.append(linha.section("\t",3,3).toDouble());
data_servidor.append(linha.section("\t",5,5).toDouble());
data_central.append(linha.section("\t",6,6).toDouble());
data_mysql.append(linha.section("\t",7,7).toDouble());
data_http1.append(linha.section("\t",8,8).toDouble());
data_http2.append(linha.section("\t",9,9).toDouble());

xPoints.append(xCounter++);
}

mrw->closeFile();
SAFEDELETE(mrw);

if (!data_emuso.isEmpty() && !data_disponivel.isEmpty() && !data_servidor.isEmpty() && !data_central.isEmpty()
&& !data_mysql.isEmpty() && !data_http1.isEmpty() && !data_http2.isEmpty())
{
QDialog *graphWindow = new QDialog(this);
graphWindow->setFixedSize(800,400);
graphWindow->setWindowTitle("Gráfico (base: 10 min)");

graphWindow->exec();
SAFEDELETE(graphWindow);
}
}


Now the code that makes the bug appear:


//...

if (!data_emuso.isEmpty() && !data_disponivel.isEmpty() && !data_servidor.isEmpty() && !data_central.isEmpty()
&& !data_mysql.isEmpty() && !data_http1.isEmpty() && !data_http2.isEmpty())
{
QDialog *graphWindow = new QDialog(this);
graphWindow->setFixedSize(800,400);
graphWindow->setWindowTitle("Gráfico (base: 10 min)");

QwtPlot *plot = new QwtPlot(graphWidget); //This line is causing the problem!!!!!!!!!!!1
graphWindow->exec();
SAFEDELETE(graphWindow);
}
}


So now what is wrong with my plot?

ChrisW67
12th March 2013, 23:58
The linker is looking for QWindowSurface::QWindowSurface(QWidget*), used in a module built with MingW, in the DLL your installer has installed and is failing to find it. This could be because your installer has installed:

a version of the Qt library built with MSVC,
a version of the Qt library built with a binary incompatible version of MingW,
a version of the Qt library from before Qt 4.3 when QWindowSurface was created, or
a version of the Qt library that does not export the symbol (which is private to Qt).

Take your pick.

Momergil
14th March 2013, 18:26
The linker is looking for QWindowSurface::QWindowSurface(QWidget*), used in a module built with MingW, in the DLL your installer has installed and is failing to find it. This could be because your installer has installed:

a version of the Qt library built with a binary incompatible version of MingW,

Take your pick.

Thanks Chris once again :) When reading your answer I remembered that the pack I used to ctrl+c/ctrl+v with the dlls required for dynamic qt apps compilation was probably from Qt 4.7 whereas I'm using Qt 4.8 and the last Qwt version :) After uptading the dlls package, a new one was required and since then the software is finally running outside Qt Creator.

Thanks again,

Momergil

amleto
16th March 2013, 00:27
you made a mistake creating the installable version.


Sorry, no way. ...


Thanks Chris once again :) When reading your answer I remembered that the pack I used to ctrl+c/ctrl+v with the dlls required for dynamic qt apps compilation was probably from Qt 4.7 whereas I'm using Qt 4.8 and the last Qwt version :) After uptading the dlls package, a new one was required and since then the software is finally running outside Qt Creator.

Thanks again,

Momergil

Thought so!

Momergil
26th March 2013, 11:26
Thought so!

^^

Thanks amleto :)