Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. error: undefined reference to 'cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
Forum Updated to NodeBB v4.3 + New Features

error: undefined reference to 'cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
14 Posts 2 Posters 4.8k 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.
  • S swansorter
    11 Mar 2021, 11:30

    sir,
    i cross compiled opencv 4.1.2 in my ubuntu pc (16.04) using cmake gui
    in my cmake set windowi given
    operating system arm-linux
    processor arm
    compilers:
    c: /opt/FriendlyARM/toolchain/4.9.3/bin/arm-cortexa9-linux-gnueabihf-cc
    c++: /opt/FriendlyARM/toolchain/4.9.3/bin/arm-cortexa9-linux-gnueabihf-c++
    target /opt/FriendlyARM/toolchain/4.9.3/arm-cortexa9-linux-gnueabihf/sys-root
    CMAKE _INSTALL_PRIFIX=usr/local/arm/openc-arm
    after cross compilation

    #-------------------------------------------------
    #
    # Project created by QtCreator 2021-03-09T14:11:00
    #
    #-------------------------------------------------
    
    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = opencv3
    TEMPLATE = app
    CONFIG += c++11
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as 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
    INCLUDEPATH += /usr/local/arm/opencv-arm/include/opencv4 \
        ./resources
    
    LIBS += -L/usr/local/arm/opencv-arm/lib -I/usr/local/arm/opencv-arm/include/opencv4 -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_objdetect
    SOURCES += \
            main.cpp \
            mainwindow.cpp
    
    HEADERS += \
            mainwindow.h
    
    FORMS += \
            mainwindow.ui
    INSTALLS = target
    target.files = opencv3
    target.path = /home/pi
    
    

    compilation output:-

    16:50:30: Running steps for project opencv...
    16:50:30: Configuration unchanged, skipping qmake step.
    16:50:30: Starting: "/usr/bin/make"
    arm-linux-gnueabihf-g++ -fuse-ld=gold -mfloat-abi=hard --sysroot=/opt/rootfs-s5p4418 -Wl,-rpath,/usr/local/Trolltech/Qt-5.10.0-nexell32/lib -o opencv3 main.o mainwindow.o moc_mainwindow.o -L/usr/nexell-libs/lib32 -L/usr/local/arm/opencv-arm/lib -I/usr/local/arm/opencv-arm/include/opencv4 -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_objdetect -L/opt/rootfs-s5p4418/usr/local/Trolltech/Qt-5.10.0-nexell32/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lpthread
    ../opencv/mainwindow.cpp:22: error: undefined reference to 'cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
    collect2: error: ld returned 1 exit status
    Makefile:251: recipe for target 'opencv3' failed
    make: *** [opencv3] Error 1

    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 11 Mar 2021, 11:47 last edited by
    #2

    @swansorter said in error: undefined reference to 'cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':

    LIBS += -L/usr/local/arm/opencv-arm/lib -I/usr/local/arm/opencv-arm/include/opencv4 -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_objdetect

    What is this?! Why do you add include folder to the libs search paths?
    What are the names of the libs inside /usr/local/arm/opencv-arm/lib?

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

    S 1 Reply Last reply 11 Mar 2021, 11:51
    0
    • J jsulm
      11 Mar 2021, 11:47

      @swansorter said in error: undefined reference to 'cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':

      LIBS += -L/usr/local/arm/opencv-arm/lib -I/usr/local/arm/opencv-arm/include/opencv4 -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_objdetect

      What is this?! Why do you add include folder to the libs search paths?
      What are the names of the libs inside /usr/local/arm/opencv-arm/lib?

      S Offline
      S Offline
      swansorter
      wrote on 11 Mar 2021, 11:51 last edited by
      #3

      @jsulm
      sorry it is
      LIBS += -L/usr/local/arm/opencv-arm/lib -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_objdetect

      Screenshot from 2021-03-11 17-21-01.png

      J 1 Reply Last reply 11 Mar 2021, 11:57
      0
      • S swansorter
        11 Mar 2021, 11:51

        @jsulm
        sorry it is
        LIBS += -L/usr/local/arm/opencv-arm/lib -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_objdetect

        Screenshot from 2021-03-11 17-21-01.png

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 11 Mar 2021, 11:57 last edited by
        #4

        @swansorter Did you try full rebuild after fixing pro file?

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

        S 1 Reply Last reply 11 Mar 2021, 11:59
        0
        • J jsulm
          11 Mar 2021, 11:57

          @swansorter Did you try full rebuild after fixing pro file?

          S Offline
          S Offline
          swansorter
          wrote on 11 Mar 2021, 11:59 last edited by
          #5

          @jsulm yess sir same error

          S 1 Reply Last reply 11 Mar 2021, 12:00
          0
          • S swansorter
            11 Mar 2021, 11:59

            @jsulm yess sir same error

            S Offline
            S Offline
            swansorter
            wrote on 11 Mar 2021, 12:00 last edited by
            #6

            @swansorter The m

            J 1 Reply Last reply 11 Mar 2021, 12:08
            0
            • S swansorter
              11 Mar 2021, 12:00

              @swansorter The m

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 11 Mar 2021, 12:08 last edited by
              #7

              @swansorter Actually you should install the libs/headers in your sysroot

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

              S 1 Reply Last reply 11 Mar 2021, 12:13
              0
              • J jsulm
                11 Mar 2021, 12:08

                @swansorter Actually you should install the libs/headers in your sysroot

                S Offline
                S Offline
                swansorter
                wrote on 11 Mar 2021, 12:13 last edited by
                #8

                @jsulm how to install the libs/headers in my sysroot

                J 1 Reply Last reply 11 Mar 2021, 12:16
                0
                • S swansorter
                  11 Mar 2021, 12:13

                  @jsulm how to install the libs/headers in my sysroot

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 11 Mar 2021, 12:16 last edited by
                  #9

                  @swansorter Simply copy them to your sysroot...

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

                  S 1 Reply Last reply 11 Mar 2021, 12:27
                  0
                  • J jsulm
                    11 Mar 2021, 12:16

                    @swansorter Simply copy them to your sysroot...

                    S Offline
                    S Offline
                    swansorter
                    wrote on 11 Mar 2021, 12:27 last edited by swansorter 3 Nov 2021, 12:27
                    #10

                    @jsulm what i need to copy and in sysroot where i need to paste?

                    J 1 Reply Last reply 11 Mar 2021, 12:29
                    0
                    • S swansorter
                      11 Mar 2021, 12:27

                      @jsulm what i need to copy and in sysroot where i need to paste?

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 11 Mar 2021, 12:29 last edited by
                      #11

                      @swansorter Libs to: /opt/rootfs-s5p4418/usr/lib
                      Include files to: /opt/rootfs-s5p4418/usr/include

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

                      S 1 Reply Last reply 11 Mar 2021, 12:56
                      0
                      • J jsulm
                        11 Mar 2021, 12:29

                        @swansorter Libs to: /opt/rootfs-s5p4418/usr/lib
                        Include files to: /opt/rootfs-s5p4418/usr/include

                        S Offline
                        S Offline
                        swansorter
                        wrote on 11 Mar 2021, 12:56 last edited by
                        #12

                        @jsulm
                        from : usr/local/arm/opencv-arm/libs To: /opt/rootfs-s5p4418/usr/lib
                        from : usr/local/arm/opencv-arm/include To: /opt/rootfs-s5p4418/usr/include
                        ist this write?

                        J 1 Reply Last reply 11 Mar 2021, 12:59
                        0
                        • S swansorter
                          11 Mar 2021, 12:56

                          @jsulm
                          from : usr/local/arm/opencv-arm/libs To: /opt/rootfs-s5p4418/usr/lib
                          from : usr/local/arm/opencv-arm/include To: /opt/rootfs-s5p4418/usr/include
                          ist this write?

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 11 Mar 2021, 12:59 last edited by
                          #13

                          @swansorter yes

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

                          S 1 Reply Last reply 11 Mar 2021, 13:15
                          0
                          • J jsulm
                            11 Mar 2021, 12:59

                            @swansorter yes

                            S Offline
                            S Offline
                            swansorter
                            wrote on 11 Mar 2021, 13:15 last edited by
                            #14

                            @jsulm i followed above steps still same error

                            1 Reply Last reply
                            0

                            11/14

                            11 Mar 2021, 12:29

                            • Login

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