0

When I try to run a script with

#include "libtiff.h"

when compiling, the compiler gives me all sorts of trouble with the UINT and INT data types used in the rest of the LibTiff library.

In file included from H:\tiff-4.0.9\libtiff\tiffio.h:33:0,
             from savetiff.cpp:1:
H:\tiff-4.0.9\libtiff\tiff.h:68:27: error: expected initializer before 'int8'
  typedef int TIFF_INT8_T   int8;

H:\tiff-4.0.9\libtiff\tiff.h:69:36: error: expected initializer before 'uint8'
  typedef unsigned int TIFF_UINT8_T  uint8;

H:\tiff-4.0.9\libtiff\tiff.h:71:27: error: expected initializer before 'int16' 
  typedef int TIFF_INT16_T  int16;

H:\tiff-4.0.9\libtiff\tiff.h:72:36: error: expected initializer before 'uint16' 
 typedef unsigned int TIFF_UINT16_T uint16;

H:\tiff-4.0.9\libtiff\tiff.h:74:27: error: expected initializer before 'int32'
 typedef int TIFF_INT32_T  int32;

H:\tiff-4.0.9\libtiff\tiff.h:75:36: error: expected initializer before 'uint32'
 typedef unsigned int TIFF_UINT32_T uint32;

H:\tiff-4.0.9\libtiff\tiff.h:77:27: error: expected initializer before 'int64' 
 typedef int TIFF_INT64_T  int64;

H:\tiff-4.0.9\libtiff\tiff.h:78:36: error: expected initializer before 'uint64' 
 typedef unsigned int TIFF_UINT64_T uint64;

Does anyone know how to fix this, other than going into each error message (there are a ton) and fixing everything individually? I am working on Ubuntu, by the way.

Thanks!

meat
  • 609
  • 3
  • 8
Julia
  • 11
  • 4
  • 1
    I suspect that it is the same issue as [this](https://stackoverflow.com/questions/13978225/libtiff-not-able-to-work-with-c-project). Wrap the include in `extern "C" {}` – meat Jul 02 '18 at 20:49
  • 1
    Please supply a [MCVE] (that is, a small, complete, self- contained program) that demonstrates this problem. Then, somone might be able to help you. Thx. – Paul Sanders Jul 02 '18 at 21:14

1 Answers1

0

I had a similar issue and I solved it. You need to check the file H:\tiff-4.0.9\libtiff\tiff.h. Probably there are some preprocessor definitions that need to be defined by you. In my case, there was a line:

#ifdef LINUX

After I defined LINUX in another file (in my case, in CMakeLists.txt), the issue was solved.

Unique
  • 63
  • 7