错误LNK2019无法解析的外部符号Tesseract OCR C ++ using VS 2015 [英] Error LNK2019 unresolved external symbol Tesseract OCR C++ Using VS 2015

查看:435
本文介绍了错误LNK2019无法解析的外部符号Tesseract OCR C ++ using VS 2015的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人成功配置了 Tesseract c ++源代码?它有32颗星,但我仍然坚持按原样运行它

Have someone configured Tesseract c++ source-code successfully? It has 32 stars, but I am stuck to even run it as it is

当我尝试在自己的Visual Studio中设置Tesseract的源代码时,它在obj文件中给出了错误,我该如何编辑这些文件,这对我来说没有任何意义.如果我不这样做,那么在我的环境中成功运行它应该做些什么(我具有与

While I am trying to setup the source code of Tesseract in my visual studio, it is giving errors in obj files, how can I edit those files, its not making any sense to me. If I do not do that then what different I should do to run it successfully at my environment (I have same specs as required by the github)

1.Error LNK2019无法解析的外部符号_l_dnaDiffAdj在函数_ptraConcatenatePdfToData pdfio2.obj中引用的值

1.Error LNK2019 unresolved external symbol _l_dnaDiffAdjValues referenced in function _ptraConcatenatePdfToData pdfio2.obj

2.错误LNK2019无法解析的外部符号_l_dnaJoin在函数_recogAppend recogbasic.obj中引用

2.Error LNK2019 unresolved external symbol _l_dnaJoin referenced in function _recogAppend recogbasic.obj

3.Error LNK1120 2无法解析的外部tesseract.exe

3.Error LNK1120 2 unresolved externals tesseract.exe

我使用以下设置构建它:

I Build it with following setps :

1.从此链接下载.

2.下载了 tesseract 3.它包含一个build_tesseract.bat以构建最新的tesseract版本.

3.It contains a build_tesseract.bat to build the latest tesseract version.

4.我选择了tesseract作为启动项目

4.I had selected the tesseract as start up Project

这是我的.cpp主文件

here is my .cpp main file

#include "baseapi.h";
#include "allheaders.h";

int main()
{
    char *outText;

    tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
    // Initialize tesseract-ocr with English, without specifying tessdata path
    if (api->Init(NULL, "eng")) {
        fprintf(stderr, "Could not initialize tesseract.\n");
        exit(1);
    }

    // Open input image with leptonica library
    Pix *image = pixRead("/usr/src/tesseract/testing/phototest.tif");
    api->SetImage(image);
    // Get OCR result
    outText = api->GetUTF8Text();
    printf("OCR output:\n%s", outText);

    // Destroy used object and release memory
    api->End();
    delete[] outText;
    pixDestroy(&image);

    return 0;
}

推荐答案

错误指出无法运行x64/debug/zlib.lib文件.可以,因为.lib库文件不是可执行文件.

Error states that it's not possible to run x64/debug/zlib.lib file. It's OK as .lib library file is not executable file.

最有可能的是,如果没有编译错误,则问题的原因是在启动配置中.将您的main.cpp所在的项目设置为 启动项目 .

Most likely, if you have no compilation errors, reason of the problem is in startup configuration. Set project where your main.cpp located as Startup Project.

要编译Tesseract,您应该将下载的 Leptonica 源放入VS2015_Tesseract-master\leptonica文件夹,然后下载 Tesseract 源文件放入VS2015_Tesseract-master\tesseract_3.04.我假设VS2015_Tesseract已解压到VS2015_Tesseract-master文件夹中.

To compile Tesseract you should put downloaded Leptonica sources into VS2015_Tesseract-master\leptonica folder and downloaded Tesseract sources into VS2015_Tesseract-master\tesseract_3.04. I assume VS2015_Tesseract unpacked into VS2015_Tesseract-master folder.

之后,打开VS2015_Tesseract-master\tesseract.sln并构建tesseract项目.您不需要使用build_tesseract.bat.

After that open VS2015_Tesseract-master\tesseract.sln and build tesseract project. You don't need to use build_tesseract.bat.

tesseract构建的结果为tesseract.exe.我已经将main()函数的逻辑放入VS2015_Tesseract-master\tesseract_3.04\api\tesseractmain.cpp文件的main(int argc, char **argv)中.它为我成功编译.

The result of tesseract build is tesseract.exe. I've put your logic of main() function into main(int argc, char **argv) in VS2015_Tesseract-master\tesseract_3.04\api\tesseractmain.cpp file. It successfully compiled for me.

这篇关于错误LNK2019无法解析的外部符号Tesseract OCR C ++ using VS 2015的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆