Problem using static build lib in static build application on Linux
-
On my Linux box I got a static and dynamic install of Qt 4.8.0.
I created a project, it builds and executes as a dynamic and a static build.
Now I have moved some classes out of this project and create a library from them.
It contains log in, change passwords dialogs (very simple) which we want to use in all our Qt projects.The library builds fine as a static and dynamic build (debug and release).
I created a test program which includes this library. It builds either way fine.
When the lib and the application are both build dynamically (debug and release) everything works.
Now I did a static lib build and a static application build. It builds fine but I get the following crash:
QWidget: Must construct a QApplication before a QPaintDevice
Looking up the above error hasn't helped me.Is it even possible to do what I am trying to do? static lib in static app????
As the dynamic build works fine I am a bit confused why it would not work.
I have run ldd on the executable and no Qt library is listed.here is my test app project file:
@QT += core gui
networkTARGET = udp_test
TEMPLATE = app
INCLUDEPATH += /proj/jenosys/jebs/jebs_linux/qt_lib/ul
/proj/jenosys/jebs/jebs_linux/qt_lib/ul_static_release # Need this to get ui_xxx.hLIBS += -L$$PWD/../../../jebs/jebs_linux/qt_lib/ul_static_release/ -lul
unix:{
QMAKE_LFLAGS += -Wl,--rpath=/proj/jenosys/jebs/jebs_linux/qt_lib/ul_static_release
QMAKE_LFLAGS_RPATH=
}SOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui@
Here is the code where I try to use the lib:
Main.cpp
@#include <QtGui/QApplication>
#include "mainwindow.h"int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();return a.exec();
}@
mainwindow.cpp
@#include <QtGui/QApplication>
#include <QDebug>
#include <QUdpSocket>
#include <QMessageBox>
#include <QDateTime>#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "ul_login.h"
#include "ui_ul_login.h"MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);udp_setup(); qDebug() << "befor login_dlg"; ul_login_dlg *xp_ul_login = new ul_login_dlg( 0, this ); qDebug() << "after ul_login_dlg *xp_ul_login"; if ( xp_ul_login->exec() == QDialog::Rejected ) { qDebug() << "Login dialog rejected"; } xp_ul_login->close(); delete xp_ul_login;
}@
Thanks for your help!