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

Linking error with zlib library - LNK2019: unresolved external symbol _deflate referenced in function



  • Hi,

    I am using deflate() method from the zlib library. I have setup the library path correctly in .pro file but still I am getting the linking error
    qzip.obj : error LNK2019: unresolved external symbol _deflate referenced in function "int __cdecl deflate(unsigned char *,unsigned long *,unsigned char const *,unsigned long)" (?deflate@@YAHPAEPAKPBEK@Z)

    Below is the code from .pro file
    win32:LIBS += -L$$PWD/../3rdParty/zlib/lib -lzlib

    Can you please help me in understanding what the issue is?

    Any help is really appreciated.



  • @rajendrasp79
    That deflate@@YAHPAEPAKPBEK@Z looks like a "decorated" name for a class member function or a namespace or something? I think zlib stuff is all non-class-global-methods (or is it)?



  • I think that deflate is referring to the my local function. I have a static method named deflate() and I am calling library function deflate() from it



  • @rajendrasp79 said in Linking error with zlib library - LNK2019: unresolved external symbol _deflate referenced in function:

    I have a static method named deflate() and I am calling library function deflate() from it

    Show that bit of code, in case there is an issue there.

    Also, especially if it's Windows which it looks like, are you sure the compiler/linker you use (MSVC, MinGW) are consistent used across your code and the library you are trying to ling against?



  • I got the fix, the problem was that the kit I was using was VS 2015 and the lib was probably built using VS 2017. I switched to VS 2017 and it is working fine


Log in to reply