0

Qt's standard image library does not support multi-layer and multi-channel TIFF files, so I wanted to use libtiff for that and downloaded it from http://download.osgeo.org/libtiff/

I built it with nmake (nmake /f makefile.vc), linked to the library in Qt and tried to build the project afterwards, but I'm getting the following error messages.

enter image description here

The build command is

C:\Qt\5.12.3\mingw73_64\bin\qmake.exe C:\Sync\Programmierung\Qt\MAIAS2Database\MAIAS2Database.pro -spec win32-g++ "CONFIG+=qtquickcompiler" && C:/Qt/Tools/mingw730_64/bin/mingw32-make.exe qmake_all

and I have checked the header and library files. They are in the same folder and got included in the project with

unix|win32: LIBS += -L$$PWD/lib/libtiff/ -llibtiff

INCLUDEPATH += $$PWD/lib/libtiff
DEPENDPATH += $$PWD/lib/libtiff

I am pretty sure I compiled the libtiff library wrong or have to do some extra steps, but I can't figure it out. I'm using Qt on Windows 10 and would love to get this to work.

Thanks for any help!

Endauriel
  • 402
  • 5
  • 17
  • 2
    `makefile.vc` -- Was that library built with Visual C++? If so, then you need to build your application with the Visual C++ compiler toolset. – PaulMcKenzie Apr 18 '20 at 23:28
  • I used the Visual Studio Developer Console and just entered the command "nmake /f makefile.vc" without any further configuration. Would I be able to somehow make this work with Qt on Windows? What would I have to use to build the library instead of nmake? – Endauriel Apr 18 '20 at 23:30
  • According to what you indicate libtiff has been compiled using VS (nmake) and you want to use it with mingw, mmm, and that cannot be done. – eyllanesc Apr 18 '20 at 23:30
  • `C:\Qt\5.12.3\mingw73_64` -- Then you're using mingw to build your application? That isn't going to work. The mingw uses `g++` as the compiler toolset. – PaulMcKenzie Apr 18 '20 at 23:31
  • 1
    If you want to compile using mingw then you should use "mingw32-make"(or "mingw64-make") instead of nmake – eyllanesc Apr 18 '20 at 23:32
  • Also you mention "Qt on Windows". QT is not a compiler -- it is configured to use a compiler that is installed on your system. Thus it can launch different compiler toolsets, depending on the configuration. – PaulMcKenzie Apr 18 '20 at 23:33
  • @eyllanesc I did try that, but when I used "mingw32-make" with any of the makefiles (Makefile.in is probably the correct one) it just told me there was "Nothing to be done". – Endauriel Apr 18 '20 at 23:33
  • TBH, sometimes it is just plain easier to add the libtiff source to your application and not need to build any external libraries, and just compile it with your app. It is about 20 or so `.c` files (from what I remember). – PaulMcKenzie Apr 18 '20 at 23:35
  • @Endauriel please read the readme: `./configure` `make` `make install` – eyllanesc Apr 18 '20 at 23:40
  • @eyllanesc Isn't that for Linux? Windows will find neither of those commands. – Endauriel Apr 18 '20 at 23:48
  • another solution is create a .pri – eyllanesc Apr 18 '20 at 23:50
  • @PaulMcKenzie I've tried your solution, but some of the files seem to contain syntax errors that make compiling them impossible. – Endauriel Apr 18 '20 at 23:51
  • What were the errors? Probably you need to adjust the `tiffconf.h` and/or `tiff_config.h` files to fit your compiler. Other than that, the files are generic `.C` files. – PaulMcKenzie Apr 19 '20 at 00:06
  • @PaulMcKenzie "Unknown type name "TIFF_INT8_T" and a bunch of others in "tiff.h", the same in "tiffiop.h" and other files. – Endauriel Apr 19 '20 at 00:12
  • ok. I have an old copy of libtiff, and `TIFF_INT8_T` is defined in tiffconf.h as `signed char`. You need to get a good source code browser to figure out these errors, TBH. – PaulMcKenzie Apr 19 '20 at 00:17
  • @PaulMcKenzie I got it down to a bunch of Pragma Warnings, but 3 errors still remain, all 3 in "tiff.h". C:\Sync\Programmierung\Qt\MAIAS2Database\libtiff\tiff.h:75: Error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int64' C:\Sync\Programmierung\Qt\MAIAS2Database\libtiff\tiff.h:76: Error: expected '=', ',', ';', 'asm' or '__attribute__' before 'uint64' C:\Sync\Programmierung\Qt\MAIAS2Database\libtiff\tiff.h:105: Error: unknown type name 'uint64' – Endauriel Apr 19 '20 at 00:21
  • Make sure that `tiffconf.h` is defining `TIFF_UINT64_T` for the build. – PaulMcKenzie Apr 19 '20 at 00:30
  • That file contains #define TIFF_UINT64_T unsigned __int64 – Endauriel Apr 19 '20 at 00:34
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/211984/discussion-between-paulmckenzie-and-endauriel). – PaulMcKenzie Apr 19 '20 at 00:43

0 Answers0