2

我想将 tesseract 与 qt 5 + mingw 一起使用。我从这里下载了 vc++ libs fir

在我的应用程序中,我做了:

#include "tesseract/baseapi.h"


...


tesseract::TessBaseAPI *OCRbase =  new tesseract::TessBaseAPI();

if (!OCRbase->Init(NULL,"eng",tesseract::OEM_DEFAULT))
{
    qDebug() << "tesseract init error";
    return;
}

但是这段代码给了我这样的错误:

testOCR/dialog.cpp:57: undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'
debug/dialog.o: In function `ZN9tesseract11TessBaseAPI4InitEPKcS2_NS_13OcrEngineModeE':
testOCR/tesseract-3.02.02-win32-lib-include-dirs/include/tesseract/baseapi.h:208:   undefined reference to `tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*, GenericVector<STRING> const*, bool)'
collect2.exe: error: ld returned 1 exit status

我的 .pro 文件如下所示:

INCLUDEPATH += $$PWD\tesseract-3.02.02-win32-lib-include-dirs\include
LIBS += -L$$PWD\tesseract-3.02.02-win32-lib-include-dirs\lib -llibtesseract302-static-debug
LIBS += -L$$PWD\leptonica\lib -lliblept

SOURCES += main.cpp\
        dialog.cpp

HEADERS  += dialog.h

FORMS    += dialog.ui

我花了很多时间试图链接这个,我做错了什么吗?

4

1 回答 1

0

我确实设法自己用mingw编译了tesseract,但是在我尝试将它与我的测试应用程序链接之后,我得到了很多:

tesseract-ocr\ccutil\tprintf.cpp:56: ошибка: undefined reference to `_Unwind_Resume'

pageiterator.cpp:-1: ошибка: undefined reference to `__gxx_personality_v0'

错误。那是什么意思?这次我在我的专业文件中添加了

LIBS    += -L$$PWD\lib -llept -ltesseract -ltiff -lwebp -lgif -lpng -ljpeg -lzlib125-static-mtdll-debug
LIBS    += lws2_32
于 2013-10-20T23:59:32.530 回答