Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

zlib under Qt5



  • I have a program originally developed under Qt4 which used zlib.

    I have in the *.PRO file a line stating LIBS += libz.a which links the zLib

    While compiling the same project under Qt5 I get
    ***.cpp:-1: error: undefined reference to 'inflate'

    I compile it in Windows with MingW.
    I can compile the same project in Linux and ARM in Qt5.

    How comes?
    How to resolve? - (I can't use qCompress/qUncompress as I'm reading ZIP compressed files)



  • @gkavrecic

    While compiling the same project under Qt5 I get
    ***.cpp:-1: error: undefined reference to 'inflate'

    Can you confirm you get this error while compiling, not linking? If it's while compiling it would be a header file issue, not a library.



  • Sometimes just asking a question makes you really think...

    In order to use zlib I had to add LIBS += -lz

    Hopes it help others



  • @JonB, you're right.
    This error normally pops up during linking.
    Sorry for the typo.


Log in to reply