Qt creator 2.8.1 and Qt4.8.5, Windows libtiff



  • Hi All,
    i am a new in Qt. I have installed the qt creator 2.8.1 and qt 4.8.5 and now want to use external lib libtiff
    after a long search i have configured the .pro file successfully liks:

    SOURCES += main.cpp
    mainwindow.cpp
    GUI.cpp
    makeDNG.cpp

    HEADERS += mainwindow.h
    GUI.h
    makeDNG.h

    FORMS += mainwindow.ui

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/"C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiff"
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/"C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiffd"
    else:unix: LIBS += "-L$$PWD/C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiff"

    INCLUDEPATH += "C:/Program Files (x86)/tiff-3.9.4/libtiff"
    DEPENDPATH += "C:/Program Files (x86)/tiff-3.9.4/libtiff"

    INCLUDEPATH += "C:/Program Files (x86)/tiff-3.9.4/libtiff"
    DEPENDPATH += "C:/Program Files (x86)/tiff-3.9.4/libtiff"

    and now when i compile it occurs the errors always:

    E:\janosch\QT\js_v21\makeDNG.cpp:156: Fehler:undefined reference to TIFFOpen' E:\janosch\QT\js_v21\makeDNG.cpp:158: Fehler:undefined reference toTIFFSetField'

    can someone explain how i can fix these problems...?
    thx in advance and best regards

    sven


  • Lifetime Qt Champion

    This is very suspicious:

    bq.
    win32:CONFIG: LIBS += -L$$PWD/“C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiff”
    else:win32:CONFIG: LIBS += -L$$PWD/“C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiffd”
    else:unix: LIBS += “-L$$PWD/C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiff”

    especially the unix part using a windows path.

    You should rather have something like:
    @
    win32 {
    LIBS += -L$$quote(“C:/Program Files (x86)/tiff-3.9.4/libtiff")
    CONFIG(debug, debug|release): LIBS += -ltiffd
    CONFIG(release, debug|release): LIBS += -ltiff
    }
    @

    For unix you can use pkgconfig to setup the linking to libtiff

    Hope it helps



  • [quote author="SGaist" date="1379188967"]This is very suspicious:

    bq.
    win32:CONFIG: LIBS += -L$$PWD/“C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiff”
    else:win32:CONFIG: LIBS += -L$$PWD/“C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiffd”
    else:unix: LIBS += “-L$$PWD/C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiff”

    especially the unix part using a windows path.

    You should rather have something like:
    @
    win32 {
    LIBS += -L$$quote(“C:/Program Files (x86)/tiff-3.9.4/libtiff/)
    CONFIG(debug, debug|release): LIBS += -ltiffd
    CONFIG(release, debug|release): LIBS += -ltiff
    }
    @

    For unix you can use pkgconfig to setup the linking to libtiff

    Hope it helps[/quote]

    hallo, thanks for reply.
    i use ur recommendation but still it doesnot work.
    this error occuors : :-1: Fehler:cannot find -ltiffd
    i replaced -ltiffd with -llibtiffd but it has the same error

    do u have some material to learn how configure the .pro file especially how use external lib....

    thanks a lot


  • Lifetime Qt Champion

    Are you sure your path goes to the folder where tiff.lib and tiffd.lib are located ?

    If you are using QtCreator, your can right-click on your project and use the Add Library function and you'll just have to follow the wizard.



  • [quote author="SGaist" date="1379272096"]Are you sure your path goes to the folder where tiff.lib and tiffd.lib are located ?

    If you are using QtCreator, your can right-click on your project and use the Add Library function and you'll just have to follow the wizard.[/quote]

    Hi, this is what i use add lib function :

    win32: LIBS += -L$$PWD/C:/Program Files (x86)/tiff-3.9.4/libtiff/ -llibtiff

    INCLUDEPATH += $$PWD/C:/Program Files (x86)/tiff-3.9.4/libtiff
    DEPENDPATH += $$PWD/C:/Program Files (x86)/tiff-3.9.4/libtiff

    it is right..? i do not think ...


  • Lifetime Qt Champion

    No it's not, $$PWD should not be there and the paths should be quoted.

    Did you try the example I wrote ?



  • [quote author="SGaist" date="1379282182"]No it's not, $$PWD should not be there and the paths should be quoted.

    Did you try the example I wrote ?[/quote]

    I have tried you written code. if building the error :
    :-1: Fehler:cannot find -ltiffd
    :-1: Fehler:collect2: ld returned 1 exit status
    then i repaced -ltiffd with -llibtiffd, the error stays still:
    :-1: Fehler:cannot find -llibtiffd
    :-1: Fehler:collect2: ld returned 1 exit status

    i went back to have a look the location of the .lib file, under the path
    C:/Program Files (x86)/tiff-3.9.4/libtiff
    there are a libtiff.lib, libtiff_i.lib and libtiff.dll

    how could i continue to configure....?

    thanks


  • Lifetime Qt Champion

    AFAICS you don't have libtiffd so link to libtiff



  • [quote author="SGaist" date="1379282182"]No it's not, $$PWD should not be there and the paths should be quoted.

    Did you try the example I wrote ?[/quote]

    right. i linkend in debug with -ltiff, it seems works but still an error:
    C:\Program Files (x86)\tiff-3.9.4\libtiff\libtiff.dll:-1: Fehler:file not recognized: File format not recognized+
    this error means a bad dll file or?


  • Lifetime Qt Champion

    When does this error happen ?



  • [quote author="SGaist" date="1379362425"]When does this error happen ?[/quote]

    when i built the project..


  • Lifetime Qt Champion

    Can you show your complete pro file ?



  • [quote author="SGaist" date="1379451486"]Can you show your complete pro file ?[/quote]

    hi, this is:

    #-------------------------------------------------

    Project created by QtCreator 2013-09-03T20:35:28

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = js_v21
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp
    GUI.cpp
    makeDNG.cpp

    HEADERS += mainwindow.h
    GUI.h
    makeDNG.h

    FORMS += mainwindow.ui

    win32 {
    LIBS += -L$$quote(C:/Program Files (x86)/tiff-3.9.4/libtiff)
    CONFIG(release, debug|release): LIBS += -ltiff
    CONFIG(debug, debug|release): LIBS += -ltiff
    }


  • Lifetime Qt Champion

    I just forgot one basic question... What architecture are you building for ?



  • [quote author="SGaist" date="1379489392"]I just forgot one basic question... What architecture are you building for ?[/quote]

    Hi thanks for the help.
    as stated when i built it said the libtiff.dll has a not recoginized format.
    then i downloaded a libtiff,dll from internet and put it in the directory and now it works.
    thanks.
    but i still would like ask what does -ltiff mean? it means on linking, linkt to libtiff.dll? so what is the principle to write such thing?

    thanks again...


  • Lifetime Qt Champion

    -ltiff means: link to the library file named tiff.lib.

    On windows lib files are either static library (containing the actual library code) or stub files containing the information needed for the link phase, the dll being loaded at run time.



  • [quote author="SGaist" date="1379533471"]-ltiff means: link to the library file named tiff.lib.

    On windows lib files are either static library (containing the actual library code) or stub files containing the information needed for the link phase, the dll being loaded at run time.[/quote]

    but there is no a file called tiff.lib in the install path only a file called libtiff.lib.....


  • Lifetime Qt Champion

    then use -llibtiff.

    tiff vs libtiff is more a naming convention issue between VS libraries and gnu libraries


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.