Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. OpenCV for Android with QTCreator

OpenCV for Android with QTCreator

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 2 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aromano
    wrote on last edited by
    #1

    Hi, i am using QtCreator for build a simple app for android using OpenCV. The code compile succesfully only when there aren't OpenCV object. When i add a simple cv::Mat it fails with a lot of error of type "the vtable symbol may be undefined because the class is missing its key function" this is my .pro file:

    QT       += core gui svg multimediawidgets androidextras
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = QR_test
    TEMPLATE = app
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which has been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    CONFIG += c++11
    
    SOURCES += \
            main.cpp \
            mainwindow.cpp
    
    HEADERS += \
            mainwindow.h
    
    FORMS += \
            mainwindow.ui
    
    CONFIG += mobility
    MOBILITY = 
    
    linux:!android {
        # using pkg-config
        CONFIG += link_pkgconfig
        PKGCONFIG += opencv
    }
    INCLUDEPATH += /home/aromano/Work/OpenCV-android-sdk/sdk/native/jni/include/
    
    android {
        LIBS += \
                -L"/home/aromano/Work/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/" \
                -L"/home/aromano/Work/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/" \
                -L"/home/aromano/Work/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/" \
                -lcpufeatures \
                -lIlmImf \
                -llibjasper \
                -llibjpeg-turbo \
                -llibpng \
                -llibprotobuf \
                -llibwebp \
                -ltbb \
                -ltegra_hal \
                -lopencv_calib3d \
                -lopencv_core \
                -lopencv_dnn \
                -lopencv_features2d \
                -lopencv_flann \
                -lopencv_highgui \
                -lopencv_imgcodecs \
                -lopencv_imgproc \
                -lopencv_ml \
                -lopencv_objdetect \
                -lopencv_photo \
                -lopencv_shape \
                -lopencv_stitching \
                -lopencv_superres \
                -lopencv_video \
                -lopencv_videoio \
                -lopencv_videostab
    
        ANDROID_PACKAGE_SOURCE_DIR=$$_PRO_FILE_PWD_/android
    }
    
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    

    Thanks in advice for the reply.

    jsulmJ 1 Reply Last reply
    0
    • A aromano

      Hi, i am using QtCreator for build a simple app for android using OpenCV. The code compile succesfully only when there aren't OpenCV object. When i add a simple cv::Mat it fails with a lot of error of type "the vtable symbol may be undefined because the class is missing its key function" this is my .pro file:

      QT       += core gui svg multimediawidgets androidextras
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      TARGET = QR_test
      TEMPLATE = app
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which has been marked as deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      CONFIG += c++11
      
      SOURCES += \
              main.cpp \
              mainwindow.cpp
      
      HEADERS += \
              mainwindow.h
      
      FORMS += \
              mainwindow.ui
      
      CONFIG += mobility
      MOBILITY = 
      
      linux:!android {
          # using pkg-config
          CONFIG += link_pkgconfig
          PKGCONFIG += opencv
      }
      INCLUDEPATH += /home/aromano/Work/OpenCV-android-sdk/sdk/native/jni/include/
      
      android {
          LIBS += \
                  -L"/home/aromano/Work/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/" \
                  -L"/home/aromano/Work/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/" \
                  -L"/home/aromano/Work/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/" \
                  -lcpufeatures \
                  -lIlmImf \
                  -llibjasper \
                  -llibjpeg-turbo \
                  -llibpng \
                  -llibprotobuf \
                  -llibwebp \
                  -ltbb \
                  -ltegra_hal \
                  -lopencv_calib3d \
                  -lopencv_core \
                  -lopencv_dnn \
                  -lopencv_features2d \
                  -lopencv_flann \
                  -lopencv_highgui \
                  -lopencv_imgcodecs \
                  -lopencv_imgproc \
                  -lopencv_ml \
                  -lopencv_objdetect \
                  -lopencv_photo \
                  -lopencv_shape \
                  -lopencv_stitching \
                  -lopencv_superres \
                  -lopencv_video \
                  -lopencv_videoio \
                  -lopencv_videostab
      
          ANDROID_PACKAGE_SOURCE_DIR=$$_PRO_FILE_PWD_/android
      }
      
      
      # Default rules for deployment.
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      
      

      Thanks in advice for the reply.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @aromano Can you post the build log?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • jsulmJ jsulm

        @aromano Can you post the build log?

        A Offline
        A Offline
        aromano
        wrote on last edited by aromano
        #3

        @jsulm I have solved the issue. The problem was

        -lopencv_core 
        

        line. I have removed it and now it builds without errors.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved