编译iOS时,Qt Creator Tesseract链接器错误

时间:2021-04-10 08:56:08

I'm getting linker errors below when I try to build my iOS app. Setting C++ Standard Library to "libstdc++" probably fixes it but I am not sure how to do it in QT creator.

当我尝试构建我的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)

Related part of the .pro file

.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

1 个解决方案

#1


0  

You need to replace macx with ios when building for ios.

在为ios构建时,您需要将ix替换为ios。

I am also assuming that you have not cross compiled tesseract for ios. Here is an article that describes that process, which also contains a link specifically for tesseract and its dependencies.

我还假设您没有为ios交叉编译tesseract。这篇文章描述了该过程,该文章还包含专门针对tesseract及其依赖项的链接。

#1


0  

You need to replace macx with ios when building for ios.

在为ios构建时,您需要将ix替换为ios。

I am also assuming that you have not cross compiled tesseract for ios. Here is an article that describes that process, which also contains a link specifically for tesseract and its dependencies.

我还假设您没有为ios交叉编译tesseract。这篇文章描述了该过程,该文章还包含专门针对tesseract及其依赖项的链接。