How do I get started with a simple C++ program using the Tesseract API?

1,265 views
Skip to first unread message

shutupyoudo...@gmail.com

unread,
May 7, 2016, 3:06:55 PM5/7/16
to tesseract-ocr
Hello everyone,

Forgive me if I sound irritated, but that's precisely what I am.  I'm on a Linux mint machine and I have installed tesseract through apt-get.

The program works just fine through the command line, but I need to use the C++ API, so I tried following along here:



The problem is, I literally cannot even get the simple example program to compile past the first line when I try to include baseapi.h.

I have copies of all the header files from the api/ , ccutil/ , ccmain/ , and ccstruct/ directories in the same directory as my program.cpp file,

but when I try to compile, I still get errors, namely:  

/usr/bin/ld: cannot find -llept
/usr/bin/ld: cannot find -ltesseract.


Guys, I love Tesseract and am forever grateful to the people who are working on this and who make it freely available to the world, but all I want to do is use tesseract's API.  

I'm not asking for a lot.  Instead, I have to fight with the software and spend hours figuring out a ridiculously complex setup process that should be simple and properly documented.  

I realize this is open-source software and that this is how it is sometimes, but the extent to which developers are expected to just figure this stuff out and spend hours researching how to get started is absurd.

Again, forgive me for complaining, but I had to let out some steam.  I appreciate any help you guys can give.

Thanks!



Rolf Mertig

unread,
May 7, 2016, 3:22:40 PM5/7/16
to tesseract-ocr
Hello,
did you build leptonica and tesseract from source?
I did so with leptonica 1.73 and the master branch of tesseract, in debian jessie,
and
g++ -o basicexample basicexample.cpp -llept -ltesseract
just compiled and running ./basicexample works.

shutupyoudo...@gmail.com

unread,
May 7, 2016, 3:30:58 PM5/7/16
to tesseract-ocr
No, I installed through apt-get.  This must be the problem because none of the library files are installed in any usr/include directories.  I will try to build from source and will post an update.

shutupyoudo...@gmail.com

unread,
May 7, 2016, 4:36:32 PM5/7/16
to tesseract-ocr
Alright!  I installed leptonica and tesseract from source and now things are working.  Thanks, Rolf, for helping me pinpoint the source of the problem!


On Saturday, May 7, 2016 at 3:22:40 PM UTC-4, Rolf Mertig wrote:
Reply all
Reply to author
Forward
0 new messages