Qwt 6.3.0  app calling Qwt 6.3.0 craches
	
	
		I have compiled Qwt 6.3.0 and see that the headers and the libs have been placed in 
/usr/local/qwt-6.3.0/include/
and
/usr/local/qwt-6.3.0/lib/
respectively. 
I have build a Qt 6.7.0 app. using the following CMakeLists file:
set(QWT_INCLUDE_DIR "/usr/local/qwt-6.3.0/include")
set(QWT_LIBRARY "/usr/local/qwt-6.3.0/lib/libqwt.so")
set(qwt_libraries ${QWT_LIBRARY}})
set(test_SRC
  src/main.cpp
  src/test.cpp
  src/Plot.cpp
)
add_executable(test ${test_SRC})
target_link_libraries(test Qt6::Widgets ${QWT_LIBRARY})
Compiling the program and running it in the debugegr it craches with the error message: 
QWidget: Must construct a QApplication before a QWidget
*** Program received signal SIGABRT (Aborted) ***
In main I have
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    test w;
    w.show();
    
    return app.exec();
}
which I think is correct.
In MainWindow (i,e, test):
test::test(QWidget *parent) :
    QMainWindow(parent),
    m_ui(new Ui::test)
{
    qDebug()  << "test::test 0";
    qDebug() << qApp;
    qDebug()  << "test::test 1";
    m_ui->setupUi(this);
    qDebug()  << "test::test 2";
    m_plot = new Plot(this);
    qDebug()  << "test::test 3";
    
Starting the debugger yields:     
test::test 0
QApplication(0x7ffde3f14770)
test::test 1
test::test 2
QWidget: Must construct a QApplication before a QWidget
*** Program received signal SIGABRT (Aborted) ***    
    
test::test 3 is never printed out, so it seems the crash happens in the Plot constructor:
Plot::Plot(QWidget *parent)
    : QwtPlot( parent )
{
    qDebug()  << "Plot::Plot 1";
    
Again, Plot::Plot 1 is not printed out. 
Can it be that Qt 6.7.0 and Qwt 6.3.0 are incompatible?
	 
	
	
	
		Re: Qwt 6.3.0  app calling Qwt 6.3.0 craches
	
	
		The warning is coming from the constructor of QWidget - what is a base class of QwtPlot - not from Qwt code.
For some reason the qApp pointer is broken - at least this is the check, that leads to the message in QWidgetPrivate::QWidgetPrivate ( see qwidget.cpp ).
HTH,
Uwe
	 
	
	
	
		Re: Qwt 6.3.0  app calling Qwt 6.3.0 craches
	
	
		Yes, but just before instantiating qwt the qApp pointer appears to be OK:
qDebug() << qApp;             // Check
QApplication(0x7ffde3f14770)  // Prints out
So it is definitely Qwt that's messing up things. 
At the top of the autogenerated README file for my test app I have this:
CMake Qt5 GUI Template
----------------------
You need Qt5 and CMake 2.8.11 or higher
Can it be that there somehow is a Qt5-Qt6 mix-up? Kubuntu 24.04 use Plasma 5.27.11, which use Qt 5.15.13. 
But the contents of the file "Qt5Qwt6.pc",  under /usr/local/qwt-6.3.0/lib/pkgconfig, reads:
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/local/qwt-6.3.0/lib
includedir=${prefix}/local/qwt-6.3.0/include
Name: Qwt6
Description: Qt Widgets for Technical Applications
Version: 6.3.0
Libs: -L${libdir} -lqwt 
Cflags: -I${includedir}
Requires: Qt5Widgets Qt5Concurrent Qt5PrintSupport Qt5OpenGL
The way I interpret this is that "Qt5Widgets" refers to Qt5 used by Plasma. So as far as I can tell everything seems right. But my app craches as soon as I instantiates Qwt... 
It is pointed out here (
https://stackoverflow.com/questions/...e-a-qwidg?rq=3) that using different compiler versions can case trubble, but I built Qt 6.7 and Qwt 6.3.0 with the same compiler (gcc 13.2.0), so it cannot be that.
	 
	
	
	
		Re: Qwt 6.3.0  app calling Qwt 6.3.0 craches
	
	
		Maybe using ldd to find out what libraries/dependencies your application has ?
HTH,
Uwe