Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leptonica conflicts with Xcode framework

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 ?

like image 877
Xinlei Avatar asked Nov 08 '22 17:11

Xinlei


1 Answers

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.

like image 81
Josh Avatar answered Nov 14 '22 22:11

Josh