编译后的内置包错误 - C++



我一直在尝试调试这些包错误,任何建议的解决方案都无法解决问题。

对于 tesseract 包中无法从外部更改uint32_t错误,我该如何解决。

任何人都可以看看它并提出任何合适的解决方案。请帮忙。

 /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
    /usr/local/include/tesseract/host.h:35:9: error: 'uint8_t' does not name a type
     typedef uint8_t uinT8;
             ^
    /usr/local/include/tesseract/host.h:37:9: error: 'uint16_t' does not name a type
     typedef uint16_t uinT16;
             ^
    /usr/local/include/tesseract/host.h:39:9: error: 'uint32_t' does not name a type
     typedef uint32_t uinT32;
             ^
    /usr/local/include/tesseract/host.h:41:9: error: 'uint64_t' does not name a type
     typedef uint64_t uinT64;
    PlateDetector.cpp:100:23: error: 'const class QString' has no member named 'toAscii'
         QString (filename.toAscii().data());
                           ^
    ../../src/engine/PlateDetector.cpp:101:44: error: 'const class QString' has no member named 'toAscii'
         m_videoCapture = VideoCapture(filename.toAscii().data());
                                                ^
    ../../src/engine/PlateDetector.cpp:134:47: error: 'class QString' has no member named 'toAscii'
                             strcpy(plate_str, str.toAscii().data());
                                                   ^

这是我发生这些错误的cpp文件

#include "PlateDetector.h"
#include<iostream>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/opencv.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<sstream>
#include<string>
#include<sys/types.h>
#include <stdio.h>
#include <QString>
#include <QDataStream>
#if defined __UINT32_MAX__ or UINT32_MAX
  #include <inttypes.h>
  #else
  typedef unsigned char uint8_t;
  typedef unsigned short uint16_t;
  typedef unsigned long uint32_t;
  typedef unsigned long long uint64_t;
  #endif
using namespace cv;
using namespace std;

  QString (*filename);
PlateDetector *PlateDetector::m_instance = 0;
PlateDetector::PlateDetector()
{
    m_plateThresh=85;
    m_symbolMin=7;
    m_symbolMax=9;
    m_symbolCharacters=8;
    m_plateGoodForOcr = 0;
    m_detectionTime = 0.0;
    m_thresh = 50;
    m_xminmargin=0;
    m_xmaxmargin=352;
    m_yminmargin=0;
    m_ymaxmargin=288;
    m_cSrcStep=352;
    m_count_step=0;
    m_tAPI = new tesseract::TessBaseAPI();
PlateDetector* PlateDetector::getInstance()
{
    if (m_instance == 0)
    {
        m_instance = new PlateDetector;
        if (m_instance == 0)
        {
            printf("Memory Allocation Error when creating data structuresn");
        }
    }
    return m_instance;
}

bool PlateDetector::plateDetect(const QString &filename)
{
    m_detectFlag = true;
     (filename.toAscii().data());   //error
    m_videoCapture = VideoCapture(filename.toAscii().data());  //error
    if(!m_videoCapture.isOpened())
    {
        return false;
    }

这是它的PRO文件。

TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = 
        main 
        process 
        gui 
        #
QT += widgets
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x000000`
QT += core
QMAKE_CXX += -std=gnu++11
QMAKE_CXXFLAGS += -std=c++0x
QMAKE_CXXFLAGS += -std=c++11

INCLUDEPATH += -I/usr/local/include/tesseract -I/usr/local/include/leptonica
INCLUDEPATH += -I/usr/local/include/opencv
LIBS +=  -L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab
 -lopencv_photo -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired 
-lopencv_ccalib -lopencv_cvv -lopencv_dpm -lopencv_face -lopencv_freetype 
-lopencv_fuzzy -lopencv_hdf -lopencv_line_descriptor -lopencv_optflow -lopencv_reg
 -lopencv_rgbd -lopencv_saliency -lopencv_sfm -lopencv_stereo -lopencv_structured_light
 -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets
 -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_ml -lopencv_xfeatures2d -lopencv_shape
 -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_highgui 
-lopencv_videoio -lopencv_flann -lopencv_xobjdetect -lopencv_imgcodecs -lopencv_objdetect
 -lopencv_xphoto -lopencv_imgproc -lopencv_core
LIBS += -L/usr/local/lib -ltesseract -lavformat -lavcodec -lavutil -lpthread
LIBS +=-L/usr/local/lib -llept
    添加以下编译器开关:-std=c++11
  1. 或 -std=gnu++11 以打开 std::uint8_t 等C++11 功能。
  2. QString不包含名为"toAscii"的函数,因此请重构该代码。

相关内容

  • 没有找到相关文章

最新更新