【问题标题】:error: ISO C++ forbids declaration of 'TessBaseAPI' with no type?错误:ISO C++ 禁止声明没有类型的“TessBaseAPI”?
【发布时间】:2012-03-21 07:13:35
【问题描述】:

我有一个 OCR 应用程序。我正在为我的应用程序使用 tesseract api 库。但是当我运行应用程序时,它会显示错误(错误:ISO C++ 禁止声明没有类型的 'TessBaseAPI'?)。

这是个谜。

@interface OCRViewController : UIViewController <UIImagePickerControllerDelegate,UINavigationControllerDelegate>{
   UIImagePickerController *imagePickerController;
   //Getting error in this line.
   TessBaseAPI *tess;
   UIImageView *iv;
   UILabel *label;
}

【问题讨论】:

    标签: iphone ocr tesseract


    【解决方案1】:

    您必须添加 tesseract 命名空间,或者使用:

    using namespace tesseract;
    

    或:

    tesseract::TessBaseAPI *tess;
    

    【讨论】:

      【解决方案2】:

      我已经尝试了以下解决方案,这确实有效 请重命名

      ma​​in.m ==> main.mm

      ViewController.m ==> ViewController.mm

      AppDelegate.m ==> AppDelegate.mm

      这意味着直接的 C++ 样式的头文件将不再包含(通过引用)在您的普通 Obj-C 源代码中。 希望这会有所帮助,并且有意义。如果这有帮助,请给我竖起大拇指。 谢谢,

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-09-30
        • 2011-08-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-16
        • 2015-10-31
        • 2020-12-28
        相关资源
        最近更新 更多