如何在 Visual Studio 2013 中动态包含库

How to dynamically include libs in Visual Studio 2013

我按照 this 指南编译了 tesseract 的调试 DLL

现在我得到了要包含在我的项目中的 DDL。所以我在 linker/lib 目录中添加了 lib 目录,在 linker/input 中添加了 lib 名称,在 include 目录中添加了 "baseapi.h" 的位置。所以我包含在我的项目中 "baseapi.h"。

但是,当我尝试编译以下行时出现编译错误:

tesseract::TessBaseAPI *myOCR = new tesseract::TessBaseAPI(); 

我收到很多错误,例如 IntelliSense:

variable "tesseract::TESS_LOCAL" 
IntelliSense: this declaration has no storage class or type specifier. 

文件如下:

看库的代码,TESS_LOCALapi/baseapi.h里面几个函数定义前使用的宏,定义在ccutil/platform.h.

如果您只是关注 the instructions,您就会发现您需要:

include Leptonica’s allheaders.h, and Tesseract-OCR’s baseapi.h and strngs.h.

这将拉入您需要的东西。