spmallick / learnopencv

Learn OpenCV : C++ and Python Examples
https://www.learnopencv.com/
21.01k stars 11.57k forks source link

I found a compilation error about OCR #659

Open chinlee1523 opened 2 years ago

chinlee1523 commented 2 years ago

@spmallick hi I found this error when COMPILING OCR code on my MAC /opencv/opencv_ex/OCR/ocr_simple.cpp:3:10: fatal error: 'leptonica/allheaders.h' file not found

include <leptonica/allheaders.h>

     ^~~~~~~~~~~~~~~~~~~~~~~~

1 error generated. make[2]: [CMakeFiles/ocr_simple.dir/ocr_simple.cpp.o] Error 1 make[1]: [CMakeFiles/ocr_simple.dir/all] Error 2 make: * [all] Error 2 So the code here should be:**

#ifdef __APPLE__
#include <allheaders.h>
#else
#include <leptonica/allheaders.h>
#endif

and the original code is

#include <leptonica/allheaders.h>
brmarkus commented 2 years ago

Without trying on my own - as I don't have an APPLE available right now - looks like "APPLE" is not set, is not defined, so going into the "#else" branch.

Can you check whether you have the file "allheaders.h" somewhere in your file-system?