Search code examples
c++linkerartificial-intelligenceocrtesseract

Initializing tesseract API's TessBaseAPI to api pointer with C++ giving error


I am using the latest Tesseract API for C++ and I followed the last answer on this post to link what is necessary. These are my includes:

#include<iostream>
#include<Windows.h>
#include<opencv2/opencv.hpp>
#include<stdint.h>
#include<tesseract/baseapi.h>
#include<leptonica/allheaders.h>

When I try to initialize the api pointer with:

    tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();

it gives me the following relevant console errors (56 total from the root issue):

E1097   unknown attribute "no_init_all"
Warning C4101   'outText': unreferenced local variable
Error   LNK2001 unresolved external symbol __GSHandlerCheck_EH4 //this repeats for 52 of the errors
Error   LNK1120 1 unresolved externals

So my questions are, Why is it wrong? What am I doing wrong?

My Suspicions: Some sort of linking error, even though I followed the guide on post step by step.

I am fairly new to C++ and tesseract, any insight will be greatly appreciated.


Solution

  • Try compiling it with VS2019. The recent builds of Tesseract were built with VS2019.