C++ Tesseract API结果生成器错误编译

C++ Tesseract API结果生成器错误编译,c++,ocr,tesseract,C++,Ocr,Tesseract,我想使用来自tesseract的ResultIterator,我使用的源代码给出了如下示例: Pix *image = pixRead("test.png"); tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI(); api->Init(NULL, "eng"); api->SetImage(image); api->Recognize(0); tesseract::ResultIterator* ri = api

我想使用来自tesseract的
ResultIterator
,我使用的源代码给出了如下示例:

Pix *image = pixRead("test.png");
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
api->Init(NULL, "eng");
api->SetImage(image);
api->Recognize(0);
tesseract::ResultIterator* ri = api->GetIterator();
tesseract::PageIteratorLevel level = tesseract::RIL_WORD;
if (ri != 0) {
  do {
    const char* word = ri->GetUTF8Text(level);
    float conf = ri->Confidence(level);
    int x1, y1, x2, y2;
    ri->BoundingBox(level, &x1, &y1, &x2, &y2);
    printf("word: '%s';  \tconf: %.2f; BoundingBox: %d,%d,%d,%d;\n",
           word, conf, x1, y1, x2, y2);
    delete[] word;
  } while (ri->Next(level));
}
但我在编译时有一个错误:

ocr.cpp: In function ‘int main(int, char**)’:
ocr.cpp:82:34: error: invalid use of incomplete type ‘class tesseract::ResultIterator’
In file included from ocr.cpp:10:0:
/usr/include/tesseract/baseapi.h:83:7: error: forward declaration of ‘class tesseract::ResultIterator’
ocr.cpp:83:28: error: invalid use of incomplete type ‘class tesseract::ResultIterator’
In file included from ocr.cpp:10:0:
/usr/include/tesseract/baseapi.h:83:7: error: forward declaration of ‘class tesseract::ResultIterator’
 ocr.cpp:85:15: error: invalid use of incomplete type ‘class tesseract::ResultIterator’
In file included from ocr.cpp:10:0:
/usr/include/tesseract/baseapi.h:83:7: error: forward declaration of ‘class tesseract::ResultIterator’
ocr.cpp:89:20: error: invalid use of incomplete type ‘class tesseract::ResultIterator’
In file included from ocr.cpp:10:0:
/usr/include/tesseract/baseapi.h:83:7: error: forward declaration of ‘class tesseract::ResultIterator’
我的
tesseract-ocr-dev
版本是3.02.01-6,而
libtesseract-dev
版本是3.02.01-6

您必须
#包含
类tesseract::ResultIterator的定义
我有包含
#包含
的可能重复项还不够吗@保罗M