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

问题描述:

我一直在试图从长时间调试这些程序包错误,并提出任何解决方案无法解决问题。

对于错误是在tesseract包不能改变外部,我该如何解决它。

任何人都可以看看它,并建议任何合适的解决方案。请帮忙。编译后的内置程序包错误 - C++

/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()); 
               ^

这是这些错误发生

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

这是它的PRO FILE我的cpp文件。

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 
+0

我已添加,但没有变化。 – sophie

  1. 添加以下编译器开关:-std = C++ 11或-std = GNU ++ 11接通C++ 11层的功能,如标准:: uint8_t。
  2. QString不包含称为“toAscii”的函数,因此重构该代码。