Nominate our 2022 Qt Champions!

[solved] trouble linking libtiff with vc++

  • Dear Qt Fans,

    I am trying to link libtiff to a Qt Project using QtCreator and the compiler from Visual Studio 2012, 64bit. Libtiff compiled just fine using the supplied

    The arguments in the .pro file are

    @INCLUDEPATH = -I"..\tiff-4.0.3\libtiff" -I"..\tiff-4.0.3\port"
    LIBS += -L"..\tiff-4.0.3\libtiff" # ..\tiff-4.0.3\port\libport.lib ..\tiff-4.0.3\libtiff\libtiff.lib ..\tiff-4.0.3\libtiff\libtiff_i.lib@

    and the linker seems to find the corresponding .lib files. Yet, the linker cant resolve "TIFFOpen" "TIFFClose" "TIFFWriteScanline" "TIFFSetField" external symbols.
    I can however, find the symbols in the lib file. dumpbin yields

    @ 010 00000170 SECT5 notype () External | _TIFFClose
    008 00000000 SECT3 notype Static | ?module@?1??TIFFOpen@@9@9 (TIFFOpen'::2'::module)
    00D 0000000C SECT3 notype Static | ?module@?1??TIFFOpenW@@9@9 (TIFFOpenW'::2'::module)
    034 000000C0 SECT5 notype () External | _TIFFOpen
    035 000001B0 SECT5 notype () External | _TIFFOpenW@

    I suspect that some build argument for Qt is different so the name mangling schemes are not compatible. What are your ideas? I have read something about wchar_t being a native type or not. Or could it be static vs dynamic linking?


  • Lifetime Qt Champion


    Out of curiosity, why do you need to link against libtiff ? Tiff support is already implemented in Qt

  • Hi, thanks for the answer!

    Yes, tiff is supported by Qt, but i need to save data with 16bit per sample. I think thats not possible with the built in tiff routines. (I'd be glad to be corrected here)

  • Lifetime Qt Champion

    AFAIK you're correct about the 16bit.

    One trick that you could use is to include the tiff.pri from Qt's sources in your project so it will be built/linked with your code. Not the most economic way but so you are sure to have a working libtiff on windows (and no need to install another one)

  • Dear SGaist,

    thanks for the hint, it worked! libtiff.pri produces the tiff_* objs in the build directory and links without problems.

    Sorry for the late reply, I didnt get back to this earlier.

Log in to reply