tesseract-ocr how to includ baseapi.h

13,151

This is what I did to compile it:

1.) Copy all header files into one includedirectory, so later only §(TESS_DIR)\include has to be added to the include directories.

copy the leptonica headers into $(TESS_DIR)\include\leptonica.

2.) Open vs2010\tesseract.sln and compile all configurations. Then copy all lib files into $(TESS_DIR)\lib\debug and $(TESS_DIR)\lib\release. Then add those directories to the build settings.

3.) Copy the compiled libtesseract.dll and liblept168.dll as well as the folder tessdata, containg eng.traineddata, to the Release folder of your project.

4.) Add these libraries as additional dependencies:

libtesseract.lib
liblept168.lib

5.) #include <baseapi.h>

Share:
13,151
user1049837
Author by

user1049837

Updated on June 04, 2022

Comments

  • user1049837
    user1049837 about 2 years

    I followed the instructions I found in form of tessesract on how to includ baseapi.h.

    i am using:

    vs2010
    Version tesseract 3.01

    i try to understand how to use baseapi.h.

    test program:

    #define __MSW32__
    
     #include "baseapi.h"
    
    using namespace  tesseract;
    
    int _tmain(int argc, _TCHAR* argv[])
    
    {
    
       TessBaseAPI *myTestApi;
    
       myTestApi=new TessBaseAPI();
    
       //myTestApi->Init("d:/temp.jpg","eng");
    
       return 0;
    
    }
    

    form gide:

    add the following folders to Additional Include Directories (properties) - to resolve file not found issues after including "baseapi.h"

    tesseract-3.01/api

    tesseract-3.01/ccmain

    tesseract-3.01/ccutil

    tesseract-3.01/ccstruct enter image description here

    added the following libs to "Properties/Linker/Input/Additional Dependancies" in order to use the Tesseract and Leptonica libs libtesseract.lib;liblept.lib

    enter image description here // added the following paths to "Properties/Linker/General/Additional Library Directories" in order to find the Tesseract and Leptonica libs tesseract-3.01/vs2010/Release tesseract-3.01/vs2008/lib

    enter image description here

    And I try to run now

    enter image description here

    So I try to find libs libtesseract.lib and replaced with libtesseract_tessopt.lib and then run enter image description here

    1>------ Build started: Project: test4, Configuration: Debug Win32 ------
    1>  test4.cpp
    1>test4.obj : error LNK2019: unresolved external symbol "public: __thiscall tesseract::TessBaseAPI::TessBaseAPI(void)" (??0TessBaseAPI@tesseract@@QAE@XZ) referenced in function _wmain
    1>c:\users\eran0708\documents\visual studio 2010\Projects\test4\Debug\test4.exe : fatal error LNK1120: 1 unresolved externals
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    

    Is anything known solution to the problem?

    thanks,

    eran

    ![enter image description here][6]

    ![enter image description here][7]