当我尝试构建我的iOS应用程序时,我收到了链接器错误。将C ++标准库设置为“libstdc ++”可能会修复它,但我不确定如何在QT创建器中执行此操作。
Undefined symbols for architecture armv7:
"tesseract::TessBaseAPI::End()", referenced from:
Ocr::~Ocr() in ocr.o
"tesseract::TessBaseAPI::SetImage(Pix const*)", referenced from:
Ocr::recognize(char const*) in ocr.o
"tesseract::TessBaseAPI::GetUTF8Text()", referenced from:
Ocr::recognize(char const*) in ocr.o
"_pixRead", referenced from:
Ocr::recognize(char const*) in ocr.o
"_pixDestroy", referenced from:
Ocr::recognize(char const*) in ocr.o
"tesseract::TessBaseAPI::TessBaseAPI()", referenced from:
Ocr::Ocr(char const*) in ocr.o
"tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*, GenericVector<STRING> const*, bool)", referenced from:
Ocr::Ocr(char const*) in ocr.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
.pro文件的相关部分
QMAKE_CXXFLAGS = -stdlib=libstdc++
macx: LIBS += -L$$PWD/TesseractOCR/lib/ -llept
INCLUDEPATH += $$PWD/TesseractOCR/include
DEPENDPATH += $$PWD/TesseractOCR/include
macx: PRE_TARGETDEPS += $$PWD/TesseractOCR/lib/liblept.a
macx: LIBS += -L$$PWD/TesseractOCR/lib/ -ltesseract_all
INCLUDEPATH += $$PWD/TesseractOCR/include
DEPENDPATH += $$PWD/TesseractOCR/include
macx: PRE_TARGETDEPS += $$PWD/TesseractOCR/lib/libtesseract_all.a
答案 0 :(得分:0)
构建ios时需要用ios替换mac。
我还假设您没有为ios交叉编译的tesseract。 Here is an article that describes that process, which also contains a link specifically for tesseract and its dependencies.