Compiling Tesseract 3.02.02 with Visual C++ 2008 (Express) is covered by the documentation whereas compiling Tesseract 3.03 isn’t covered at all, though.
Unfortunately newer versions of Tesseract also require a new version of Leptonica, a C library for image processing and image analysis applications, which in turn requires new versions of zlib, libpng, libtiff, libjpeg and giflib. Tesseract provides pre-compiled versions of Leptonica, which prevents you from having to collect and set up projects for all of these libraries in Visual Studio, which can be a tedious task.
Yesterday I found a project on GitHub that includes a Visual Studio solution file for all dependencies required to compile Tesseract 3.03: charlesw/tesseract-vs2012. While following the build instructions there, I stumpled over several build errors, which I could easily resolve by removing a definition. The necessary change is in my fork of the repository mentioned above.
This is a write-up of all steps that are required to compile Tesseract 3.03 with Visual Studio 2013.
- Install Git.
- Install SVN. There are many versions of SVN. You can, for example, install the binary package from SlickSVN for free.
- Install Visual Studio 2013 for Windows Desktop (the Express version will be enough). You don’t need the optional features except for “Microsoft Foundation Classes for C++”.
Building the dependencies
- Create a directory where you want to compile Tesseract. In this document, I’ll assume it’s
- Open a CMD prompt and change to that directory.
- Clone the dependencies repository from GitHub.
git clone https://github.com/SGGS-IT/tesseract-ocr.git
- Open the “VS 2013 Developer Command Prompt”. (It can be found in the Start Menu.)
- Change to the newly cloned repository.
- Build the dependencies
- You can close the “VS 2013 Developer Command Prompt”.
- Re-open the first command prompt and ensure it’s still in
- Get the latest source from SVN.
svn checkout http://tesseract-ocr.googlecode.com/svn/trunk/
- Change to the newly checked-out repository.
- Apply the patch provided in
svn patch ..\tesseract-vs2012\vs2013+64bit_support.patch
- Copy both directories in
C:\Tesseract-Build\. Now you should have
C:\Tesseract-Build\tesseract-ocr\vs2013\tesseract.slnwith Visual Studio 2013.
F7on your keyboard. Both
tesseractshould compile without errors.
The Visual Studio solution file contains configurations for dynamic and static compilation as well as debugging and release configurations for both 32-Bit and 64-Bit. Select whichever configuration you need and recompile with
You can find the compiled binaries in