2016-01-25 61 views
0

我有一个奇怪的错误。 我想建立一个简单的例子。错误tesseract qt

.pro文件:

... 

LIBS += ... -llept 
LIBS += ... -ltesseract 

main.cpp中:

char *outText; 

tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI(); 
// Initialize tesseract-ocr with English, without specifying tessdata path 
if (api->Init(NULL, "eng")) { 
    fprintf(stderr, "Could not initialize tesseract.\n"); 
    exit(1); 
} 

// Open input image with leptonica library 
Pix *image = pixRead("/usr/src/tesseract-3.02/phototest.tif"); 
api->SetImage(image); 
// Get OCR result 
outText = api->GetUTF8Text(); 
printf("OCR output:\n%s", outText); 

// Destroy used object and release memory 
api->End(); 
delete [] outText; 
pixDestroy(&image); 

return 0; 

错误:

.../liblept.a(zlibmem.o): undefined reference to symbol 'deflate' error adding symbols: DSO missing from command line collect2: error: Ld returned 1 exit status

+1

undefined'deflate'听起来像缺少zlib。你用'-lz'链接了吗? –

+0

Thx它解决了我的问题! –

回答

-1

您必须将源文件(的.cpp)添加到的.pro文件。

Similar problem

+1

可能不是。听起来更像是缺少路径的库。 –