本文介绍了带有libc ++的Tesseract-OCR 3.02的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! Xcode 4.6,iOS SDK 6.1,tesseract-ocr 3.02 由于上一个OpenCV版本是使用 libc ++ 构建的,因此tesseract- ocr是使用 libstdc ++ 构建的,它们不能在一个xcode项目中一起使用。 所以,我正在尝试使用libc ++构建tesseract。使用脚本此处(更新基本sdk和将目标部署到6.1),tesseract正在构建得很好,并且一旦C ++标准库设置为编译器默认值,就可以在我的xcode项目中工作。然而,根据这里的答案,我试图改变脚本以使用libc ++构建它。我将 CXX 更改为指向 clang ++ ,并将 -stdlib = libc ++ 添加到 CXXFLAGS 。 结果是脚本成功,并且构建了库,但是当选择libc ++作为xcode中的C ++标准库时,我遇到了很多链接器错误,项目构建失败了。当标准库设置为编译器默认值时,新库仍然有效(就像定期生成时一样)。 我缺少什么?Xcode 4.6, iOS SDK 6.1, tesseract-ocr 3.02Since the last OpenCV versions are built using libc++, and tesseract-ocr is built using libstdc++, they can't be used together in one xcode project.So, I'm trying to build tesseract using libc++. Using the script here (updating the base sdk and deploy target to 6.1), tesseract is being built just fine, and works in my xcode project once the C++ standard library is set to the compiler default. Than, I tried altering the script to build it with libc++, according to the answer here. I changed CXX to point to clang++, and added -stdlib=libc++ to the CXXFLAGS.The result is that the script succeeds, and the libraries are built, but when choosing libc++ as the C++ standard library in xcode, I'm getting a lot of linker errors and the project build fails. The new libraries still work when the standard library is set to the compiler default (just like when it was built regularly).What am I missing?推荐答案好的,我的问题是在我的项目中添加和删除对库的引用几次后,我的库中出现了很多问题搜索路径。另外,我没有将新的include文件夹(在构建tesseract时创建)添加到用户标题搜索路径。Ok, so my problem was that after adding and removing references to libraries a few times in my project, I had quite a mess in my Library Search Paths. Plus, I didn't add the new "include" folder (created when building tesseract) to the User Header Search Paths.所以,只需快速回顾一下,按顺序使用libc ++构建tesseract-ocr,因此它可以与更新的OpenCV版本一起使用:So, just a quick recap, in order to build tesseract-ocr using libc++, so it can work along with newer OpenCV versions: 下载leptonica-1.69 下载tesseract 3.02 将它们安排在原始教程中解释的文件夹结构中这里 下载这个脚本到同一个文件夹。 编辑相关IOS_BASE_SDK和IOS_DEPLOY_TGT的脚本。 编辑CXX以使用clang ++:CXX =/ usr / bin / clang ++ 编辑CXXFLAGS以使用libc ++作为标准库:CXXFLAGS =$ CFLAGS -stdlib = libc ++ 使用脚本并构建tesseract和leptonica。 将这些库添加到xcode项目中,更改C ++标准库 设置为libc ++。 确保您的库搜索路径设置没有指向任何旧的tesseract库。 确保您的用户 标题搜索路径设置指向构建新库时创建的新include文件夹。 现在,当您尝试构建项目时,您将有一些缺少的标题文件。只需从tesseract和leptonica的旧include文件夹中复制它们。Download leptonica-1.69Download tesseract 3.02Arrange them in the folder structure explained in the original tutorial hereDownload this script to the same folder.Edit the script for your relevant IOS_BASE_SDK and IOS_DEPLOY_TGT.Edit CXX to use clang++: CXX="/usr/bin/clang++"Edit CXXFLAGS to use libc++ as the standard library: CXXFLAGS="$CFLAGS -stdlib=libc++"Use the script and build tesseract and leptonica.Add these libraries to your xcode project, change the "C++ Standard Library" setting to libc++.Make sure your "Library Search Paths" setting is not pointing to any old tesseract libs.Make sure your "User Header Search Paths" setting is pointing to the new "include" folder created when you built the new libs.Now, when you try building your project, you'll have a few missing header files. Just copy them from the old "include" folder from tesseract and leptonica.就是这样。此时,您将拥有一个能够同时使用新的OpenCV版本和tesseract 3.02的项目。如果是一个新项目,请不要忘记编辑前缀文件,以便在__cplusplus的情况下包含OpenCV和Tesseract,并使用它们将任何.m文件重命名为.mmThat's it. At this point, you'll have a project capable of using both new OpenCV versions AND tesseract 3.02 together. If it's a new project, don't forget to edit your prefix file accordingly to include OpenCV and Tesseract in case of __cplusplus, and rename any .m file using them to .mm非常感谢这个答案,这让我很顺利。Big thanks to to this answer, that got me well on my way. 这篇关于带有libc ++的Tesseract-OCR 3.02的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!