简体   繁体   English

在Visual C ++ 2010中构建Tesseract

[英]Building Tesseract in Visual C++ 2010

When I try to build the Tesseract solution in Visual C++ 2010 Express it's saying: 当我尝试在Visual C ++ 2010 Express中构建Tesseract解决方案时,它说:

21>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "post-build.cmd "C:\Tesseract-OCR\tesseract-3.01\vs2010\Release\" "C:\Tesseract-OCR\tesseract-3.01\vs2010\bin.rel"
21>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 4.
========== Build: 20 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I don't know how to proceed. 我不知道该怎么办。 Does anyone know what the problem is and how I can solve it? 有谁知道问题是什么以及我如何解决它?

You have to edit post-build.cmd file in [tesseract source]\\vs2010 folder as follows Open the file, in Notepad++ for example, and "rem" the following lines: 您必须在[tesseract source] \\ vs2010文件夹中编辑post-build.cmd文件,如下所示:在Notepad ++中打开文件,然后“rem”以下行:

xcopy ..\vs2008\lib\liblept168%DebugVersion%.dll %TargetFolder% /Y /I /D
rem copy data
if not exist %DataFolder% (
   md %DataFolder%
)
xcopy ..\TessData\eng.traineddata %DataFolder% /Y /I /D

This should do it, if you have installed the executables previously. 如果您之前已安装了可执行文件,则应该这样做。 Since tesseract gets the \\tessdata\\ folder from environmental variable ( TESSDATA_PREFIX ) in "mainblk.cpp" file in main_setup function there is no need to copy data folder as instructed in post-build.cmd. 由于tesseractmain_setup函数的“mainblk.cpp”文件中的环境变量( TESSDATA_PREFIX )获取\\tessdata\\文件夹,因此无需按照post-build.cmd中的说明复制数据文件夹。

If you didn't install the executables then you have to create this variable manually. 如果您没有安装可执行文件,则必须手动创建此变量。 the value should indicate the folder where \\tessdata\\ resides no the \\tessdata\\ itself since in the last line of main_setup \\tessdata is added to the path. 该值应指示\\ tessdata \\所在的文件夹没有\\ tessdata \\本身,因为在main_setup \\tessdata的最后一行中添加了该路径。

run vs2010 as administrator and build again as raym0nd has suggested. 以管理员身份运行vs2010并再次构建raym0nd建议。 It worked for me. 它对我有用。

You probably didn't install tesseract-ocr-3.01.eng.tar.gz properly. 您可能没有正确安装tesseract-ocr-3.01.eng.tar.gz

From their readme : 从他们的自述文件

Download these packages: 下载这些包:

tesseract-3.01.tar.gz - tesseract source tesseract-3.01.tar.gz - tesseract来源

tesseract-3.01-win_vs.zip - Visual studio (2008 & 2010) solution with necessary libraries tesseract-3.01-win_vs.zip - Visual Studio(2008和2010)解决方案,包含必要的库

tesseract-ocr-3.01.eng.tar.gz - English language file for tesseract (or download other 3.01 or 3.00 language datafile) tesseract-ocr-3.01.eng.tar.gz - tesseract的英文文件(或下载其他3.01或3.00语言数据文件)

Unpack them to one directory ('tesseract-3.01'). 将它们解压缩到一个目录('tesseract-3.01')。 tesseract-ocr-3.01.eng.tar.gz has wrong name of root directory ('tesseract-ocr' instead of 'tesseract-3.01'). tesseract-ocr-3.01.eng.tar.gz的根目录名称错误('tesseract-ocr'而不是'tesseract-3.01')。 Windows relevant files are located in vs2008 directory (eg 'tesseract-3.01\\vs2008'). Windows相关文件位于vs2008目录中(例如'tesseract-3.01 \\ vs2008')。 The same build process as usual applies: Open tesseract.sln with VC++Express 2008 and build all (or just Tesseract) It should compile (in at least release mode) without having to install anything further. 与往常一样的构建过程适用:使用VC ++ Express 2008打开tesseract.sln并构建所有(或只是Tesseract)它应该编译(至少在发布模式下)而不必进一步安装。 The dll dependencies and Leptonica are included. 包括dll依赖项和Leptonica。 Output will be in tesseract-3.01\\vs2008\\bin (or tesseract-3.01\\vs2008\\bin.rd or tesseract-3.01\\vs2008\\bin.dbg based on configuration build). 输出将在tesseract-3.01 \\ vs2008 \\ bin(或tesseract-3.01 \\ vs2008 \\ bin.rd或tesseract-3.01 \\ vs2008 \\ bin.dbg,基于配置构建)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM