错误 LNK2019 无法解析的外部符号 Tesseract OCR C++ 使用 VS 2015
Error LNK2019 unresolved external symbol Tesseract OCR C++ Using VS 2015
有人成功配置 Tesseract c++ 源代码吗?它有 32 颗星,但我什至坚持运行它的原样
当我尝试在我的 visual studio 中设置 Tesseract
的源代码时,它在 obj 文件中出现错误,我该如何编辑这些文件,这对我来说没有任何意义.如果我不这样做,那么我应该对 运行 它在我的环境中成功做些什么不同(我具有与 github 要求相同的规格)
1.Error LNK2019 unresolved external symbol _l_dnaDiffAdjValues referenced in function _ptraConcatenatePdfToData pdfio2.obj
2.Error LNK2019 unresolved external symbol _l_dnaJoin referenced in function _recogAppend recogbasic.obj
3.Error LNK1120 2 unresolved externals tesseract.exe
我使用以下设置构建它:
1.Downloaded from this Link.
2.Downloaded tesseract and leptonica.
3.It contains a build_tesseract.bat to build the latest tesseract version.
4.I had selected the tesseract as start up Project
这是我的 .cpp 主文件
#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
库文件不是可执行文件。
最有可能的是,如果您没有编译错误,问题的原因在于启动配置。将 main.cpp
所在的项目设置为 Startup Project。
要编译 Tesseract
,您应该将下载的 Leptonica sources into VS2015_Tesseract-master\leptonica
folder and downloaded Tesseract 个源代码放入 VS2015_Tesseract-master\tesseract_3.04
。我假设 VS2015_Tesseract
解压缩到 VS2015_Tesseract-master
文件夹中。
之后打开 VS2015_Tesseract-master\tesseract.sln
并构建 tesseract
项目。您不需要使用 build_tesseract.bat
.
tesseract
构建的结果是 tesseract.exe
。我已将 main()
函数的逻辑放入 VS2015_Tesseract-master\tesseract_3.04\api\tesseractmain.cpp
文件中的 main(int argc, char **argv)
中。它为我编译成功。
有人成功配置 Tesseract c++ 源代码吗?它有 32 颗星,但我什至坚持运行它的原样
当我尝试在我的 visual studio 中设置 Tesseract
的源代码时,它在 obj 文件中出现错误,我该如何编辑这些文件,这对我来说没有任何意义.如果我不这样做,那么我应该对 运行 它在我的环境中成功做些什么不同(我具有与 github 要求相同的规格)
1.Error LNK2019 unresolved external symbol _l_dnaDiffAdjValues referenced in function _ptraConcatenatePdfToData pdfio2.obj
2.Error LNK2019 unresolved external symbol _l_dnaJoin referenced in function _recogAppend recogbasic.obj
3.Error LNK1120 2 unresolved externals tesseract.exe
我使用以下设置构建它:
1.Downloaded from this Link.
2.Downloaded tesseract and leptonica.
3.It contains a build_tesseract.bat to build the latest tesseract version.
4.I had selected the tesseract as start up Project
这是我的 .cpp 主文件
#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
库文件不是可执行文件。
最有可能的是,如果您没有编译错误,问题的原因在于启动配置。将 main.cpp
所在的项目设置为 Startup Project。
要编译 Tesseract
,您应该将下载的 Leptonica sources into VS2015_Tesseract-master\leptonica
folder and downloaded Tesseract 个源代码放入 VS2015_Tesseract-master\tesseract_3.04
。我假设 VS2015_Tesseract
解压缩到 VS2015_Tesseract-master
文件夹中。
之后打开 VS2015_Tesseract-master\tesseract.sln
并构建 tesseract
项目。您不需要使用 build_tesseract.bat
.
tesseract
构建的结果是 tesseract.exe
。我已将 main()
函数的逻辑放入 VS2015_Tesseract-master\tesseract_3.04\api\tesseractmain.cpp
文件中的 main(int argc, char **argv)
中。它为我编译成功。