PDA

View Full Version : Help linking LibTiff



rdelgado
2nd September 2014, 16:53
Hello All,

I need to read some TIFF using the libtiff in Windows.
I have just build the libtiff and I have my .lib files correctly in a folder.
Then I used the QtCreator Add Library function to add the library to my project and this is the result:


#-------------------------------------------------
#
# Project created by QtCreator 2014-09-02T10:15:41
#
#-------------------------------------------------

QT += core

QT -= gui

TARGET = PruebaLibTiff
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app


SOURCES += main.cpp


win32:CONFIG(release, debug|release): LIBS += -L$$PWD/libtiff/.libs/ -ltiff
#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/libtiff/.libs/ -ltiffd
#else:unix: LIBS += -L$$PWD/libtiff/.libs/ -ltiff

INCLUDEPATH += $$PWD/libtiff/.libs
DEPENDPATH += $$PWD/libtiff/.libs

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/libtiff/.libs/ -ltiffxx
#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/libtiff/.libs/ -ltiffxxd
#else:unix: LIBS += -L$$PWD/libtiff/.libs/ -ltiffxx

INCLUDEPATH += $$PWD/libtiff/.libs
DEPENDPATH += $$PWD/libtiff/.libs

I have commented the debug and unix versions of the includes.

Then, this is my main file:


#include <QCoreApplication>
#include <QDebug>
#include <inttypes.h>
#include "C:/Qt/Programas/PruebaLibTiff/libtiff/tiffio.h"

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

TIFF *tif;
tif = TIFFOpen("MARBLES.TIF", "r");

return a.exec();
}

But when I compile and run, I keep getting the "undefined reference to TIFFOpen" error.

Could you help me? What am I doing wrong.

If I use the Ctrl-Space command in Qt, I can see all the TIFF functions, including TIFFOpen. Why cant I compile then?

Thanks!

wysota
3rd September 2014, 07:20
Just a side note -- you are aware Qt can open TIFF files using one of its plugins, right?