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

时间:2022-02-03 11:32:32

I have been trying to debug these package errors from long and any solutions suggested for it could not solve the problem.

For uint32_t error that is in tesseract package which cannot be altered externally, how shall I solve it.

Can anyone just have a look on it and suggest any suitable solution. Please do help.

我一直在尝试从长时间调试这些包错误,并且建议的任何解决方案都无法解决问题。对于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());
                                                   ^

This is my cpp file where these errors occur

这是我发生这些错误的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 structures\n");
        }
    }

    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;
    }

THIS IS THE PRO FILE FOR IT.

这是它的专业文件。

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

1 个解决方案

#1


0  

  1. Add the following compiler switch: -std=c++11 or -std=gnu++11 to turn on C++11 features like std::uint8_t.
  2. 添加以下编译器开关:-std = c ++ 11或-std = gnu ++ 11以打开像std :: uint8_t这样的C ++ 11功能。

  3. QString does not contain a function called "toAscii" so refactor that code.
  4. QString不包含名为“toAscii”的函数,因此重构该代码。

#1


0  

  1. Add the following compiler switch: -std=c++11 or -std=gnu++11 to turn on C++11 features like std::uint8_t.
  2. 添加以下编译器开关:-std = c ++ 11或-std = gnu ++ 11以打开像std :: uint8_t这样的C ++ 11功能。

  3. QString does not contain a function called "toAscii" so refactor that code.
  4. QString不包含名为“toAscii”的函数,因此重构该代码。