针对iOS进行编译时出现Qt Creator Tesseract链接器错误

Qt Creator Tesseract linker errors when compiling for iOS

提问人:user3048641 提问时间:7/21/2014 最后编辑:user3048641 更新时间:4/11/2015 访问量:746

问:

当我尝试构建我的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
C++ iOS Qt 链接器错误 tesseract

评论

0赞 Mani 8/11/2014
我也收到这个错误。你找到什么解决方案了吗?

答:

0赞 Klathzazt 4/11/2015 #1

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

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