5

I'm trying to build an OSX OCR C++ application using openFrameworks (0.9.0) with Xcode 7 .

The OCR library is Tesseract which requires Leptonica, and I've installed these two through Homebrew. Tesseract is compiled and linked as an static library (.a file) and Leptonica is added into the project by adding only the allheaders.h based on the instructions on this link.

The problem is: After I added the allheaders.h, Xcode automatically matched an argument in allheaders.h to another Macro definition in FixMath.h, which is a file in OSX CarbonCore Framework. This is causing error during compiling.

The Line in allheaders.h that conflicts is:

LEPT_DLL extern NUMA * numaFindPeaks ( NUMA *nas, l_int32 nmax, l_float32 fract1, l_float32 fract2 );

The Macro in FixMath.h that conflicts is:

#define fract1 ((Fract) 0x40000000L)

It seems like the compiler is referencing to the Macro as the definition of the argument in the function, but I don't know how to cut this connection. Can anyone give some suggestion on how to solve this problem ?

Xinlei
  • 51
  • 4

1 Answers1

2

I've just run into this issue too – it appears that this can be overcome by simply undefining the macro with:

#undef fract1

in your code.

Josh
  • 2,324
  • 1
  • 21
  • 29
  • 1
    This did help - even if it doesn't seem to be an ideal solution. In my case, using FSEvents to check for incoming files in a directory caused the issue: FSEvents still relies on CarbonCore FixMath.h (even though it should be deprecated: https://developer.apple.com/library/content/releasenotes/General/CarbonCoreDeprecations/) – paperlib Apr 28 '17 at 20:20
  • 5 years later and still happening. I love this dirty fix though. – Michal Sep 18 '22 at 14:22