You are not logged in.

#1 2025-12-15 15:10:34

jronald
Member
Registered: 2022-05-09
Posts: 198

[SOLVED] qwt not compatile with qt

env:

codes:

#include <qwt_plot.h>
#include <qapplication.h>

int main(int argc, char **argv)
{
    QApplication a(argc, argv);
    QwtPlot plot;
    return a.exec();
}

error message:

QWidget: Must construct a QApplication before a QWidget

calls stack:

1 ??                                                           0x7ffff5c9890c 
2 raise                                                        0x7ffff5c3e3a0 
3 abort                                                        0x7ffff5c2557a 
4 QMessageLogger::fatal(const char *, ...) const               0x7ffff46982e0 
5 ??                                                           0x7ffff55455b5 
6 QFramePrivate::QFramePrivate()                               0x7ffff5644f3b 
7 QFrame::QFrame(QWidget *, QFlags<Qt::WindowType>)            0x7ffff5644fbf 
8 QwtPlot::QwtPlot(QWidget *)                                  0x7ffff773d122 
9 main                                              main.cpp 7 0x5555555588e9

more info:
According to the last update date of Qwt, it is built with an older version of Qt.

Last edited by jronald (2025-12-16 01:24:26)

Offline

#2 2025-12-15 15:47:50

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,519

Re: [SOLVED] qwt not compatile with qt

Try "return a.exec();" but also your main.cpp doesn't have 12 lines so there's a good chance that that's not even the code that caused this weird looking a backtrace.

Offline

#3 2025-12-15 15:56:16

jronald
Member
Registered: 2022-05-09
Posts: 198

Re: [SOLVED] qwt not compatile with qt

Sorry, the codes has been edited for simplicity.
It's consistent now.

Offline

#4 2025-12-15 16:25:02

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,519

Re: [SOLVED] qwt not compatile with qt

Does

#include <QApplication>
#include <QFrame>

int main(int argc, char **argv)
{
    QApplication a(argc, argv);
    QFrame frame;
    return a.exec();
}

work as expected?

Does "QwtPlot *plot = new QwtPlot;" work?

Offline

#5 2025-12-15 17:05:00

jronald
Member
Registered: 2022-05-09
Posts: 198

Re: [SOLVED] qwt not compatile with qt

seth wrote:

Does

#include <QApplication>
#include <QFrame>

int main(int argc, char **argv)
{
    QApplication a(argc, argv);
    QFrame frame;
    return a.exec();
}

work as expected?

Yes, no error.

seth wrote:

Does "QwtPlot *plot = new QwtPlot;" work?

No, same error.

Last edited by jronald (2025-12-15 17:06:24)

Offline

#6 2025-12-15 17:15:40

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,519

Re: [SOLVED] qwt not compatile with qt

Probably some weird Qwt bug that makes it confused about the state of QApplication.

#include <QTimer>
…
QwtPlot *plot = nullptr;
QTimer::singleShot(5, [=](){  plot = new QwtPlot;} );
return a.exec();
…

Offline

#7 2025-12-15 17:23:00

jronald
Member
Registered: 2022-05-09
Posts: 198

Re: [SOLVED] qwt not compatile with qt

seth wrote:
#include <QTimer>
…
QwtPlot *plot = nullptr;
QTimer::singleShot(5, [=](){  plot = new QwtPlot;} );
return a.exec();
…

Same error.
Even for

QTimer::singleShot(10000, [&](){  plot = new QwtPlot;} );

same error after 10 seconds.

BTW Qwt in the official repo of archlinux is built with an older version of Qt, which is in 2024.
So it mgiht be not compatible with the current version of Qt.

Last edited by jronald (2025-12-15 17:38:20)

Offline

#8 2025-12-15 18:54:38

stu
Member
Registered: 2021-10-19
Posts: 5

Re: [SOLVED] qwt not compatile with qt

jronald wrote:

...
BTW Qwt in the official repo of archlinux is built with an older version of Qt, which is in 2024.

Yea, loking at it

Depends On      : qt5-base  qt5-svg
Optional Deps   : qt5-tools: For Designer plugin
Required By     : gnuradio  linssid  qgis  srsgui

So libqwt.so links against qt5, so trying to use it with qt6 won't relly work.
And as none of the reverse dependencies in the repo seem to support Qt6 (only qgis seems to support it ATM as "experimental"), there's probably little incentive to change that right now.
Updating qwt to Qt6 would probably mean a to introduce it as separate qwt6 package, or a create a qwt5 package for backward compatibility with those reverse deps.
Best you can probaly do is try to see if using qwt-qt6 from AUR instead works.

Last edited by stu (2025-12-15 18:58:56)

Offline

#9 2025-12-15 19:00:56

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,519

Re: [SOLVED] qwt not compatile with qt

Oh, I was under the impression you *were* using https://aur.archlinux.org/packages/qwt-qt6
Sorry.
I'm actually surprised you're not running into linker errors…

Offline

#10 2025-12-16 01:27:04

jronald
Member
Registered: 2022-05-09
Posts: 198

Re: [SOLVED] qwt not compatile with qt

I've also not considered with the major version of Qt, too unix smile

It works now, thanks.

Last edited by jronald (2025-12-16 04:35:44)

Offline

Board footer

Powered by FluxBB