Compile error ofxTesseract Apple Mach-O-Linker (id) Error


#1

Hi,

I try to get the ofxTesseract addon work with of_v0.9.8_osx but I get Mach-O-Linker errors. Anyone had the same issue? Running Xcode 8.2.1, MacOS Sierra. I used the ProjectGenerator generate the project and add the Add-on to my project.

Got it from github here and moved it to the add-on folder.

Error I got
Undefined symbols for architecture x86_64: "tesseract::TessBaseAPI::SetAccuracyVSpeed(tesseract::AccuracyVSpeed)", referenced from: ofxTesseract::setAccuracy(ofxTesseract::Accuracy) in ofxTesseract.o "tesseract::TessBaseAPI::SetVariable(char const*, char const*)", referenced from: ofxTesseract::setWhitelist(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in ofxTesseract.o "tesseract::TessBaseAPI::SetPageSegMode(tesseract::PageSegMode)", referenced from: ofxTesseract::setMode(ofxTesseract::Mode) in ofxTesseract.o "tesseract::TessBaseAPI::SetInputName(char const*)", referenced from: ofxTesseract::setup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in ofxTesseract.o "tesseract::TessBaseAPI::Init(char const*, char const*, char**, int, bool)", referenced from: tesseract::TessBaseAPI::Init(char const*, char const*) in ofxTesseract.o "tesseract::TessBaseAPI::TesseractRect(unsigned char const*, int, int, int, int, int, int)", referenced from: ofxTesseract::findText(ofPixels_<unsigned char>&, ofRectangle&) in ofxTesseract.o "tesseract::TessBaseAPI::~TessBaseAPI()", referenced from: ofxTesseract::~ofxTesseract() in main.o "tesseract::TessBaseAPI::TessBaseAPI()", referenced from: ofxTesseract::ofxTesseract() in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Got this in my ofApp.cpp
void ofApp::setup(){ ocr.setup(); ocr.setWhitelist("0123456789"); ocr.setAccuracy(ofxTesseract::ACCURATE); img.loadImage("article.png"); string result = ocr.findText(img); cout << result << endl; }

ofApp.h
#include "ofxTesseract.h"

and this, besides the empty example code:
ofxTesseract ocr; string tessStr; ofImage img;

I am new to OF no idea how I could fix this. Would really appreciate a hint in the right direction. Thanks a lot!


#2

I’m having a similar issue, same linking errors. Building for i386 just throws even more errors. @melba, did you ever come up with a fix? Anybody have any pointers? I’m using _v0.9.6_osx on MacOS Sierra, Xcode 9.2

Thanks!