Errors in Tesseract integration in iOS app

不想你离开。 提交于 2019-12-03 20:16:31

just changed "C++ Standard Library" in build settings to "libstdc++ (GNU C++ standard library)" and errors are gone… Thanks @H2CO3 for hint.

There are several issues:

Firstly ensure the file containing the code:

tess = new TessBaseAPI();
tess->SimpleInit(...);

has a file extension of .mm (Objective-C++) as it uses both Objective-C and C++.

Secondly the library looks like it hasn't been compiled for armv7, so you will need to rebuild it for any architectures you want to support, which will be one or more of armv6, armv7, armv7s and i386 (for the iPhone Simulator).

If you are targeting iOS 5.0+ then that will be all of the above apart from armv6 which isn't supported on later versions of Xcode.

Thirdly, make sure you use the same version of C++ and C++ library in both the library and the app, otherwise bad things will happen.

Make sure:

C++ Language Dialect Set "Compiler Default" instead of "GNU++11[-std=gnu++11]"

C++ Standard Library Set "Compiler Default" instead of "libc++(LLVM C++ standard library with C++11 support)"

Also check:

C Language Dialect Set "C00 [-std=c99]" instead of "GNU00 [-std=gnu99]"

and tesseract files should be referenced properly. (drag and drop files not reference properly)

ld: -weak_library and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  1. Change Project -> Project -> Build Settings -> **"Enable Bitcode" to NO

  2. also remove all linker flags in "linking" -> "Other Linker Flags" and add this

3. After that install pods by command "pod install"

It's works for me on Swift 2 and Xcode 7.2 (beta)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!