2
我想用qt 5 + mingw使用tesseract。我在我的應用我做下載VC++庫杉從hereQt和tesseract
:
#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
我花了很多時間試圖鏈接,有沒有什麼我做錯了?