[Development] Qt5 + Windows + static libraries

Jürgen Buchmüller pullmoll at t-online.de
Wed Jan 13 13:21:23 CET 2016


Hi devs!

When porting our project from Qt4 to Qt5, I ran into a severe problem
with the Windows version. On Linux everything worked fine, on Windows
it did not. Instantiating a "QApplication app;" and qDebug()ing the
"app.instance()" always returned NULL on Windows.

The details of my odyssey with this problem can be found here:
https://forum.qt.io/topic/55404/qcoreapplication-instance-is-null

The problem resulted from the executable, which was built in debug
mode, also importing the Qt5 release-DLLs, which alone took me quite
some time to find out.

And after much more trial and error, the root cause of the problem
turned out to be two of our submodules being built as static libraries
and linked against in some other submodules of the application.

As it seems now, creating "CONFIG += static create_prl" libraries and
linking against these with "CONFIG += link_prl" makes the submodules
(DLLs) which link against the static libs also import the release Qt5-
DLLs in a debug build.

Is this a known problem?
Am I the first one to stumble upon this issue?
Is it my fault or is this a real bug?

Cheers
Jürgen




More information about the Development mailing list