tesseract: Commit da03e4e breaks tesserocr compilation with header files

Related issue on Tesserocr: here

Environment

  • Tesseract Version: 4.00alpha
  • Commit Number: latest as of 2017-07-19
  • Platform: Ubuntu 16.04

Current Behavior:

Tesseract header files since commit da03e4e added the use of string in the unichar.h header file that is used during compilation by tesserocr. This causes the compilation of tesserocr to throw an error because the std library is not imported.

In file included from tesserocr.cpp:484:0:
/usr/local/include/tesseract/unichar.h:164:10: error: ‘string’ does not name a type
static string UTF32ToUTF8(const std::vector<char32>& str32);
          ^

Changing static string UTF32ToUTF8(const std::vector<char32>& str32); to static std::string UTF32ToUTF8(const std::vector<char32>& str32); in /usr/local/include/tesseract/unichar.h:164 fixes the problem for me.

I am aware that you do not provide support for product that aren’t the command-line Tesseract but I thought you might want to know since it worked before the commit.

Expected Behavior:

Hopefully make it work again, if that’s not an option, confirm that this is expected behavior.

Reproducing the error

  • Compile Leptonica from source
  • Compile Tesseract from source (I used --disable-openmp if that matters)
  • Install tesserocr with pip3 install tesserocr (obviously you need pip3 installed)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 35 (14 by maintainers)

Most upvoted comments

-DUSE_STD_NAMESPACE works 👍

Try this code before including Tesseract header files:

#include <string>
using std::string;

According to @theraysmith, the Google coding standards require string instead of std::string.