tesserocr: Latest tesseract (4.0) failed to build tesserocr
ON Ubuntu 14.04,Python 2.7
when I git the tesserocr, pip installed. then appear the follow infos:
.....
{'TESSERACT_VERSION': 262144},
In file included from tesserocr.cpp:309:0:
/usr/local/include/tesseract/unichar.h:164:10: error: ‘string’ does not name a type
static string UTF32ToUTF8(const std::vector<char32>& str32);
In file included from /usr/local/include/tesseract/osdetect.h:24:0,
from tesserocr.cpp:321:
/usr/local/include/tesseract/unicharset.h:241:10: error: ‘string’ does not name a type
static string CleanupString(const char* utf8_str) {
.....
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 27 (16 by maintainers)
The correct directive is
-DUSE_STD_NAMESPACE(see tesseract-ocr/tesseract#1045). You should be able to install the current tesserocr version by addingCPPFLAGS=-DUSE_STD_NAMESPACEprefix to the installation command.I was able to install tesserocr after replacing
stringwithstd::stringin/usr/local/include/tesseract/unicharset.hand/usr/local/include/tesseract/unichar.h.Yes.
I didn’t say your code will fail to compile with newer tesseract… Still, c8464d1 is not necessary anymore.
Tesseract is now at beta 1 stage.
This version uses std:string everywhere.
USE_STD_NAMESPACEis not needed anymore. @sirfz, you can revert c8464d13a.thanks @sirfz At last I was able to build correctly tesserocr replacing string with std::string in /usr/local/include/tesseract/unicharset.h and /usr/local/include/tesseract/unichar.h
I fixed use this method: