2013-10-19 63 views
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 

我花了很多時間試圖鏈接,有沒有什麼我做錯了?

回答

0

我還是設法編譯正方體與MinGW的自己,但之後我試圖把它與我的測試應用程序的鏈接,我得到了很多:

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