Important: Please read the Qt Code of Conduct -

Error encountered while doing a static build of a Qt application

  • Hi,
    I am trying to do a static build of my Qt application on Window. I am using Qt from the "Qt Source Package, Full Framework with Windows style line endings 5.2.1"
    Below are the commands I did:
    configure -prefix %CD%\qtbase -skip qtwebkit -skip qtwebkit-examples -no-icu -qt-zlib -static -opengl desktop
    -commercial -confirm-license
    mingw32-make install

    However when I tried to static compile my Qt application, Project 1, I am seeing these errors below:
    C:/Qt5.2.1/qtbase/lib/libQt5Widgets.a(qwindowsxpstyle.o):qwindowsxpstyle.cpp:(.text+0x3afb): undefined reference to _imp__DeleteObject@4' c:/qt/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/Qt5.2.1/qtbase/lib/libQt5Widgets.a(qwindowsxpstyle.o): bad reloc address 0x2b4 in section.rdata'
    collect2.exe: error: ld returned 1 exit status

    My file has :
    QT += core gui sql network multimedia
    greaterThan(QT_MAJOR_VERSION, 4): QT += widget

    When I tried to static compile another Qt application, Project 2, I got this error.
    error: 'QSslSocket' does not name a type QSslSocket *m_psocket;

    My file has:
    QT += core sql network concurrent xml serialport
    QT -= gui

    Have I missed some options when I configured Qt source package in the first place?

    Any help provided is much appreciated.


  • I have a similar issue as well.

    some error while compiling.

    although instead of undefined reference to i am getting something like deprecated function. No idea whats the problem.


    Scot V
    Development Team
    Fastest Web Browser