Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. OpenCV error
Forum Updated to NodeBB v4.3 + New Features

OpenCV error

Scheduled Pinned Locked Moved Solved QML and Qt Quick
15 Posts 3 Posters 1.0k 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.
  • JonBJ JonB

    @Vijaykarthikeyan
    I don't understand: you are using -llib....dll as libraries to link against, how does that work? But in any case the error is a runtime error failing to locate the .dll file, I don't see how that is connected to linking.

    V Offline
    V Offline
    Vijaykarthikeyan
    wrote on last edited by
    #6

    @JonB Screenshot 2024-01-08 195210.png

    i didnt changed the library name..can i change that

    jsulmJ 1 Reply Last reply
    0
    • V Vijaykarthikeyan

      @JonB Screenshot 2024-01-08 195210.png

      i didnt changed the library name..can i change that

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

      @Vijaykarthikeyan What @JonB means is that on Windows you need *.lib files for -l and *.dll at runtime. So, you -l are wrong.

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

      V 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Vijaykarthikeyan What @JonB means is that on Windows you need *.lib files for -l and *.dll at runtime. So, you -l are wrong.

        V Offline
        V Offline
        Vijaykarthikeyan
        wrote on last edited by
        #8

        @jsulm yes ofcourse lib for static and dll for runtime..but how to correclty link the .dll file in .pro..please someone guide me

        jsulmJ JonBJ 2 Replies Last reply
        0
        • V Vijaykarthikeyan

          @jsulm yes ofcourse lib for static and dll for runtime..but how to correclty link the .dll file in .pro..please someone guide me

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

          @Vijaykarthikeyan said in OpenCV error:

          yes ofcourse lib for static and dll for runtime

          NO! You're not using static libs!
          Again: you do not link dll files, you link lib files:

          -lNAME_OF_THE_LIB.lib
          

          When deploying the app you deploy dll files. Please read the link I gave you. And also https://doc.qt.io/qt-6/windows-deployment.html

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

          1 Reply Last reply
          0
          • V Vijaykarthikeyan

            @jsulm yes ofcourse lib for static and dll for runtime..but how to correclty link the .dll file in .pro..please someone guide me

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #10

            @Vijaykarthikeyan said in OpenCV error:

            but how to correclty link the .dll file in .pro..please someone guide me

            You don't link to .dll files. You don't mention .dll files in a .pro file. You need to stick to examples, they don't.
            OK, I think I see, they name the library files lib....dll.a.
            I don't use Windows/MinGW, is it supposed to be -lopencv....dll? Without the leading lib?
            But if your code links fine with what you have in the .pro file that's fine.

            @jsulm

            -lNAME_OF_THE_LIB.lib

            I think we are talking MinGW not MSVC here? lib....a files.

            At runtime your program has to find libopen....dll file. That needs to be in the same directory as the executable or specified in PATH. I think yours is not? Where is libopencv_....dll per error message, I only see libopencv....dll.a?

            V 1 Reply Last reply
            1
            • JonBJ JonB

              @Vijaykarthikeyan said in OpenCV error:

              but how to correclty link the .dll file in .pro..please someone guide me

              You don't link to .dll files. You don't mention .dll files in a .pro file. You need to stick to examples, they don't.
              OK, I think I see, they name the library files lib....dll.a.
              I don't use Windows/MinGW, is it supposed to be -lopencv....dll? Without the leading lib?
              But if your code links fine with what you have in the .pro file that's fine.

              @jsulm

              -lNAME_OF_THE_LIB.lib

              I think we are talking MinGW not MSVC here? lib....a files.

              At runtime your program has to find libopen....dll file. That needs to be in the same directory as the executable or specified in PATH. I think yours is not? Where is libopencv_....dll per error message, I only see libopencv....dll.a?

              V Offline
              V Offline
              Vijaykarthikeyan
              wrote on last edited by Vijaykarthikeyan
              #11

              @JonB you're absolutely correct..Thanks for clarifying me.Actually,For the previous projects using opencv..i have included one line which I'm missing in this that's why error hits.

              Actually when linking third party libraries against to Qt..we must include it's path to qmake flags.

              So, we must include this:

              # Add the include path to QMAKE_CXXFLAGS
              QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include
              
              jsulmJ 1 Reply Last reply
              0
              • V Vijaykarthikeyan

                @JonB you're absolutely correct..Thanks for clarifying me.Actually,For the previous projects using opencv..i have included one line which I'm missing in this that's why error hits.

                Actually when linking third party libraries against to Qt..we must include it's path to qmake flags.

                So, we must include this:

                # Add the include path to QMAKE_CXXFLAGS
                QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include
                
                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #12

                @Vijaykarthikeyan said in OpenCV error:

                QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include

                This is actually done using INCLUDEPATH in pro file

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

                V 1 Reply Last reply
                2
                • jsulmJ jsulm

                  @Vijaykarthikeyan said in OpenCV error:

                  QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include

                  This is actually done using INCLUDEPATH in pro file

                  V Offline
                  V Offline
                  Vijaykarthikeyan
                  wrote on last edited by
                  #13

                  @jsulm so like this:
                  INCLUDEPATH += -I$$PWD/C:/opencv2/include

                  jsulmJ 1 Reply Last reply
                  0
                  • V Vijaykarthikeyan

                    @jsulm so like this:
                    INCLUDEPATH += -I$$PWD/C:/opencv2/include

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

                    @Vijaykarthikeyan No, like shown in the documentation and the screenshot you posted: https://doc.qt.io/qt-6/qmake-variable-reference.html#includepath

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

                    V 1 Reply Last reply
                    2
                    • jsulmJ jsulm

                      @Vijaykarthikeyan No, like shown in the documentation and the screenshot you posted: https://doc.qt.io/qt-6/qmake-variable-reference.html#includepath

                      V Offline
                      V Offline
                      Vijaykarthikeyan
                      wrote on last edited by
                      #15

                      @jsulm oh..yes..NOw I understood..Thank you

                      1 Reply Last reply
                      0
                      • V Vijaykarthikeyan has marked this topic as solved on

                      • Login

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