我想将 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
我花了很多时间试图链接这个,我做错了什么吗?