Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 5.6.1 with Opencv
Forum Updated to NodeBB v4.3 + New Features

Qt 5.6.1 with Opencv

Scheduled Pinned Locked Moved Unsolved General and Desktop
20 Posts 4 Posters 6.1k Views 3 Watching
  • 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.
  • J joeQ
    9 Aug 2017, 06:06

    @navya.dubey

    Note: -L and -l

    LIBS += -Lopencv_libs_directory
    
    # add libs such as core, highgui, imgcodecs...
    LIBS += -lopencv_libs_name
    LIBS += -lopencv_libs_name
    

    like

    INCLUDE += C:/opencv/build/include
    
    LIBS += -LC:/opencv/build/x86/vc14/lin
    
    CONFIG(debug, debug|release) {
        # use debug lib
        LIBS += -lopencv_core2413d.lib
        LIBS += -lopencv_highgui2413d.lib
        LIBS += -lopencv_imgcodecs2413d.lib
        LIBS += -lopencv_imgproc2413d.lib
    }
    
    CONFIG(release, debug|release) {
        # use release lib
        LIBS += -lopencv_core2413.lib
        LIBS += -lopencv_highgui2413.lib
        LIBS += -lopencv_imgcodecs2413.lib
        LIBS += -lopencv_imgproc2413.lib
    }
    
    
    
    N Offline
    N Offline
    navya.dubey
    wrote on 9 Aug 2017, 06:25 last edited by
    #5

    @joeQ
    I am so sorry but I didn't get the meaning of -L and -l . I have just included the whole path and it says" not found"

    J 1 Reply Last reply 9 Aug 2017, 06:32
    0
    • N navya.dubey
      9 Aug 2017, 06:25

      @joeQ
      I am so sorry but I didn't get the meaning of -L and -l . I have just included the whole path and it says" not found"

      J Offline
      J Offline
      joeQ
      wrote on 9 Aug 2017, 06:32 last edited by
      #6

      @navya.dubey
      use / try again, not use \ in the path string.

      Just do it!

      N 1 Reply Last reply 9 Aug 2017, 06:40
      0
      • J joeQ
        9 Aug 2017, 06:32

        @navya.dubey
        use / try again, not use \ in the path string.

        N Offline
        N Offline
        navya.dubey
        wrote on 9 Aug 2017, 06:40 last edited by
        #7

        @joeQ the problem still remains the same now the .pro file is not showing error but .cpp shows
        0_1502260775727_Screenshot (7).png

        J 1 Reply Last reply 9 Aug 2017, 06:47
        0
        • N navya.dubey
          9 Aug 2017, 06:40

          @joeQ the problem still remains the same now the .pro file is not showing error but .cpp shows
          0_1502260775727_Screenshot (7).png

          J Offline
          J Offline
          joeQ
          wrote on 9 Aug 2017, 06:47 last edited by
          #8

          @navya.dubey

          Hi guys, Can you be careful? Please to read you pro file code. why did you use debug lib twice?

          I said not to use \ in any path. Please check you code carefully.

          Just do it!

          N 1 Reply Last reply 9 Aug 2017, 06:54
          1
          • J joeQ
            9 Aug 2017, 06:47

            @navya.dubey

            Hi guys, Can you be careful? Please to read you pro file code. why did you use debug lib twice?

            I said not to use \ in any path. Please check you code carefully.

            N Offline
            N Offline
            navya.dubey
            wrote on 9 Aug 2017, 06:54 last edited by
            #9

            @joeQ
            I tried with / as well as with \ and the problem is same anyhow.
            I deleted the repetition, problem still remains.

            J 1 Reply Last reply 9 Aug 2017, 06:59
            0
            • N navya.dubey
              9 Aug 2017, 06:54

              @joeQ
              I tried with / as well as with \ and the problem is same anyhow.
              I deleted the repetition, problem still remains.

              J Offline
              J Offline
              joeQ
              wrote on 9 Aug 2017, 06:59 last edited by
              #10

              @navya.dubey

              did you include opencv head files?

              Just do it!

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 9 Aug 2017, 07:41 last edited by
                #11

                Hi,

                In addition to all the good clues @joeQ provided, the main problem here is: trying to build an application with MinGW and link to a C++ library built with Visual Studio. It's not possible. You have to use a MinGW build of OpenCV to link to your application. Or use a VS build of Qt to link to your OpenCV lib built with Visual Studio. Note that prior to Visual Studio 2017, you also have to exactly match the versions of Visual Studio used to build everything C++ you might use in your project.

                VS2017 has backward compatibility but only with VS2015.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                N 1 Reply Last reply 10 Aug 2017, 06:43
                2
                • S SGaist
                  9 Aug 2017, 07:41

                  Hi,

                  In addition to all the good clues @joeQ provided, the main problem here is: trying to build an application with MinGW and link to a C++ library built with Visual Studio. It's not possible. You have to use a MinGW build of OpenCV to link to your application. Or use a VS build of Qt to link to your OpenCV lib built with Visual Studio. Note that prior to Visual Studio 2017, you also have to exactly match the versions of Visual Studio used to build everything C++ you might use in your project.

                  VS2017 has backward compatibility but only with VS2015.

                  N Offline
                  N Offline
                  navya.dubey
                  wrote on 10 Aug 2017, 06:43 last edited by
                  #12

                  @SGaist hey I tried to build opencv using cmake following this tutorial
                  https://www.youtube.com/watch?v=ZOSu-2Oju-A
                  there are several errors while building the code 0_1502347280180_Screenshot (8).png
                  I followed all the steps in the video but the output is not same as of the video tutorial, I hope you understood the basic problem please help.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 10 Aug 2017, 07:20 last edited by
                    #13

                    You have to tell CMake where to find Qt in order for it to build its libhighgui with the Qt backend.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    N 1 Reply Last reply 10 Aug 2017, 09:38
                    0
                    • S SGaist
                      10 Aug 2017, 07:20

                      You have to tell CMake where to find Qt in order for it to build its libhighgui with the Qt backend.

                      N Offline
                      N Offline
                      navya.dubey
                      wrote on 10 Aug 2017, 09:38 last edited by
                      #14

                      @SGaist how to tell cmake where to find qt because I have set the environment variables of the system to know the location of mingw compiler in qt.
                      what to do next?

                      M 1 Reply Last reply 10 Aug 2017, 09:46
                      0
                      • N navya.dubey
                        10 Aug 2017, 09:38

                        @SGaist how to tell cmake where to find qt because I have set the environment variables of the system to know the location of mingw compiler in qt.
                        what to do next?

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 10 Aug 2017, 09:46 last edited by
                        #15

                        @navya.dubey
                        Hi

                        like
                        cmake .. -DCMAKE_PREFIX_PATH="C:\Qt\5.7\msvc2015\lib\cmake\Qt5"

                        N 1 Reply Last reply 10 Aug 2017, 10:12
                        0
                        • M mrjj
                          10 Aug 2017, 09:46

                          @navya.dubey
                          Hi

                          like
                          cmake .. -DCMAKE_PREFIX_PATH="C:\Qt\5.7\msvc2015\lib\cmake\Qt5"

                          N Offline
                          N Offline
                          navya.dubey
                          wrote on 10 Aug 2017, 10:12 last edited by mrjj 8 Oct 2017, 10:16
                          #16

                          Where to add it

                          M 1 Reply Last reply 10 Aug 2017, 10:17
                          0
                          • N navya.dubey
                            10 Aug 2017, 10:12

                            Where to add it

                            M Offline
                            M Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 10 Aug 2017, 10:17 last edited by
                            #17

                            @navya.dubey
                            Sorry, i miss scrolled and edited your post.

                            You use it as commandline option when you call cmake as shown

                            N 1 Reply Last reply 10 Aug 2017, 10:19
                            0
                            • M mrjj
                              10 Aug 2017, 10:17

                              @navya.dubey
                              Sorry, i miss scrolled and edited your post.

                              You use it as commandline option when you call cmake as shown

                              N Offline
                              N Offline
                              navya.dubey
                              wrote on 10 Aug 2017, 10:19 last edited by
                              #18

                              @mrjj You mean I have to go to the location where CMake is present and then I have to execute this command, right?

                              M 1 Reply Last reply 10 Aug 2017, 10:22
                              0
                              • N navya.dubey
                                10 Aug 2017, 10:19

                                @mrjj You mean I have to go to the location where CMake is present and then I have to execute this command, right?

                                M Offline
                                M Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on 10 Aug 2017, 10:22 last edited by mrjj 8 Oct 2017, 10:22
                                #19

                                @navya.dubey

                                No, you make sure there is path to cmake
                                then you go to the project folder where the Cmake.tx file is and then
                                call cmake

                                if no paths, you can fully tell

                                c:\programfile\whatever\cmake .. OPTION

                                Same way as done here
                                https://forum.qt.io/topic/82074/creating-a-multi-purpose-node-editor-if-there-is-none-available/20
                                its also a Cmake project

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on 10 Aug 2017, 20:56 last edited by
                                  #20

                                  You can also add that using the GUI you showed in your post.

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0

                                  14/20

                                  10 Aug 2017, 09:38

                                  • Login

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