Have someone configured Tesseract c++ source-code successfully? It has 32 stars, but I am stuck to even run it as it is
While I am trying to setup the source code of Tesseract
in my visual studio, it is giving errors in obj files, how can I edit those files, its not making any sense to me. If I do not do that then what different I should do to run it successfully at my environment (I have same specs as required by the github)
1.Error LNK2019 unresolved external symbol _l_dnaDiffAdjValues referenced in function _ptraConcatenatePdfToData pdfio2.obj
2.Error LNK2019 unresolved external symbol _l_dnaJoin referenced in function _recogAppend recogbasic.obj
3.Error LNK1120 2 unresolved externals tesseract.exe
I Build it with following setps :
1.Downloaded from this Link.
2.Downloaded tesseract and leptonica.
3.It contains a build_tesseract.bat to build the latest tesseract version.
4.I had selected the tesseract as start up Project
here is my .cpp main file
#include "baseapi.h";
#include "allheaders.h";
int main()
{
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/testing/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;
}
Error states that it's not possible to run
x64/debug/zlib.lib
file. It's OK as.lib
library file is not executable file.Most likely, if you have no compilation errors, reason of the problem is in startup configuration. Set project where your
main.cpp
located as Startup Project.To compile
Tesseract
you should put downloaded Leptonica sources intoVS2015_Tesseract-master\leptonica
folder and downloaded Tesseract sources intoVS2015_Tesseract-master\tesseract_3.04
. I assumeVS2015_Tesseract
unpacked intoVS2015_Tesseract-master
folder.After that open
VS2015_Tesseract-master\tesseract.sln
and buildtesseract
project. You don't need to usebuild_tesseract.bat
.The result of
tesseract
build istesseract.exe
. I've put your logic ofmain()
function intomain(int argc, char **argv)
inVS2015_Tesseract-master\tesseract_3.04\api\tesseractmain.cpp
file. It successfully compiled for me.