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. Error due to Opencv but Qt does not show error message

Error due to Opencv but Qt does not show error message

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 2 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.
  • DQUY05D Offline
    DQUY05D Offline
    DQUY05
    wrote on last edited by
    #3

    Hi,
    Thank you for your help very fast, i just found the error in that i am building open project on minGW 64bit, this is not possible, i have moved it to Desktop Qt5.15 MSVC2019, but got get new error

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\cstddef:12: error: C1083: Cannot open include file: 'stddef.h': No such file or directory
    

    By the way, could you please help me to see if the stddef.h error is due to the lack of SDK or any pulgin?

    Many thanks!

    jsulmJ 1 Reply Last reply
    0
    • DQUY05D DQUY05

      Hi,
      Thank you for your help very fast, i just found the error in that i am building open project on minGW 64bit, this is not possible, i have moved it to Desktop Qt5.15 MSVC2019, but got get new error

      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\cstddef:12: error: C1083: Cannot open include file: 'stddef.h': No such file or directory
      

      By the way, could you please help me to see if the stddef.h error is due to the lack of SDK or any pulgin?

      Many thanks!

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

      @DQUY05 said in Error due to Opencv but Qt does not show error message:

      minGW 64bit, this is not possible

      Why not? Recent Qt versions also support MinGW 64bit.

      Regarding building with MSVC2019: do you build in QtCreator?

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

      DQUY05D 1 Reply Last reply
      0
      • jsulmJ jsulm

        @DQUY05 said in Error due to Opencv but Qt does not show error message:

        minGW 64bit, this is not possible

        Why not? Recent Qt versions also support MinGW 64bit.

        Regarding building with MSVC2019: do you build in QtCreator?

        DQUY05D Offline
        DQUY05D Offline
        DQUY05
        wrote on last edited by
        #5

        @jsulm said in Error due to Opencv but Qt does not show error message:

        @DQUY05 said in Error due to Opencv but Qt does not show error message:

        minGW 64bit, this is not possible

        Why not? Recent Qt versions also support MinGW 64bit.

        Regarding building with MSVC2019: do you build in QtCreator?

        with MinGW 64bit, when using opencv, before I found it very good, but now when I open the old project, it gives error

        D:\DATA\QT\Du-an-Quy\Desktop\Build\..\CAMERA\mainwindow.cpp:40: error: undefined reference to `cv::VideoCapture::~VideoCapture()'
        debug/mainwindow.o: In function `__tcf_4':
        D:\DATA\QT\Du-an-Quy\Desktop\Build/../CAMERA/mainwindow.cpp:40: undefined reference to `cv::VideoCapture::~VideoCapture()'
        

        while quoting the library I don't change, this .pro file

        QT += multimedia multimediawidgets
        
        INCLUDEPATH += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/include
        LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_core410.dll
        LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_highgui410.dll
        LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_imgproc410.dll
        LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_videoio410.dll
        LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_imgcodecs410.dll
        LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_features2d410.dll
        LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_video410.dll
        

        Only when declaring "VideoCapture capture;" do I get that error

        #include <opencv2/highgui/highgui.hpp>
        #include <opencv2/core/core.hpp>
        #include <opencv2/imgproc/imgproc.hpp>
        #include <opencv2/video/video.hpp>
        
        using namespace cv;
        using namespace std;
        
        VideoCapture capture;
        

        It's just that it's been a while since I reopened the project, so I don't know what's wrong with the operation, please take a look
        many thanks!

        jsulmJ 1 Reply Last reply
        0
        • DQUY05D DQUY05

          @jsulm said in Error due to Opencv but Qt does not show error message:

          @DQUY05 said in Error due to Opencv but Qt does not show error message:

          minGW 64bit, this is not possible

          Why not? Recent Qt versions also support MinGW 64bit.

          Regarding building with MSVC2019: do you build in QtCreator?

          with MinGW 64bit, when using opencv, before I found it very good, but now when I open the old project, it gives error

          D:\DATA\QT\Du-an-Quy\Desktop\Build\..\CAMERA\mainwindow.cpp:40: error: undefined reference to `cv::VideoCapture::~VideoCapture()'
          debug/mainwindow.o: In function `__tcf_4':
          D:\DATA\QT\Du-an-Quy\Desktop\Build/../CAMERA/mainwindow.cpp:40: undefined reference to `cv::VideoCapture::~VideoCapture()'
          

          while quoting the library I don't change, this .pro file

          QT += multimedia multimediawidgets
          
          INCLUDEPATH += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/include
          LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_core410.dll
          LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_highgui410.dll
          LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_imgproc410.dll
          LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_videoio410.dll
          LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_imgcodecs410.dll
          LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_features2d410.dll
          LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_video410.dll
          

          Only when declaring "VideoCapture capture;" do I get that error

          #include <opencv2/highgui/highgui.hpp>
          #include <opencv2/core/core.hpp>
          #include <opencv2/imgproc/imgproc.hpp>
          #include <opencv2/video/video.hpp>
          
          using namespace cv;
          using namespace std;
          
          VideoCapture capture;
          

          It's just that it's been a while since I reopened the project, so I don't know what's wrong with the operation, please take a look
          many thanks!

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

          @DQUY05 What compiler was used to build OpenCV? You have to use same compiler for both, Qt and OpenCV.
          "LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_core410.dll" - looks like your OpenCV build is x86, not x86_64. You would need to build OpenCV with MinGW 64bit.

          Also, on Windows you usually add *.lib to the pro file, not *.dll. lib is needed at link time and dll at runtime.

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

          DQUY05D 1 Reply Last reply
          1
          • jsulmJ jsulm

            @DQUY05 What compiler was used to build OpenCV? You have to use same compiler for both, Qt and OpenCV.
            "LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_core410.dll" - looks like your OpenCV build is x86, not x86_64. You would need to build OpenCV with MinGW 64bit.

            Also, on Windows you usually add *.lib to the pro file, not *.dll. lib is needed at link time and dll at runtime.

            DQUY05D Offline
            DQUY05D Offline
            DQUY05
            wrote on last edited by
            #7

            @jsulm said in Error due to Opencv but Qt does not show error message:

            @DQUY05 What compiler was used to build OpenCV? You have to use same compiler for both, Qt and OpenCV.
            "LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_core410.dll" - looks like your OpenCV build is x86, not x86_64. You would need to build OpenCV with MinGW 64bit.

            Hi,
            even if i switch opencv to 64 bit
            C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64
            I still have the same error, maybe I used Qt MSVC2019 with Opencv application before and it was successful, now with MinGW 64-bit it doesn't work, maybe there is a mistake in the include library
            I will learn more, get more information, I hope you can help me
            Many thanks!

            jsulmJ 2 Replies Last reply
            0
            • DQUY05D DQUY05

              @jsulm said in Error due to Opencv but Qt does not show error message:

              @DQUY05 What compiler was used to build OpenCV? You have to use same compiler for both, Qt and OpenCV.
              "LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_core410.dll" - looks like your OpenCV build is x86, not x86_64. You would need to build OpenCV with MinGW 64bit.

              Hi,
              even if i switch opencv to 64 bit
              C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64
              I still have the same error, maybe I used Qt MSVC2019 with Opencv application before and it was successful, now with MinGW 64-bit it doesn't work, maybe there is a mistake in the include library
              I will learn more, get more information, I hope you can help me
              Many thanks!

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

              @DQUY05 As I already wrote before: your OpenCV libs have to be compiled with the same compiler you use with Qt. In this case MinGW 64bit. It is not going to work if OpenCV was build with Microsoft compiler.
              You simply can't mix incompatible compilers.

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

              1 Reply Last reply
              0
              • DQUY05D DQUY05

                @jsulm said in Error due to Opencv but Qt does not show error message:

                @DQUY05 What compiler was used to build OpenCV? You have to use same compiler for both, Qt and OpenCV.
                "LIBS += C:/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_core410.dll" - looks like your OpenCV build is x86, not x86_64. You would need to build OpenCV with MinGW 64bit.

                Hi,
                even if i switch opencv to 64 bit
                C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64
                I still have the same error, maybe I used Qt MSVC2019 with Opencv application before and it was successful, now with MinGW 64-bit it doesn't work, maybe there is a mistake in the include library
                I will learn more, get more information, I hope you can help me
                Many thanks!

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

                @DQUY05 To analyse the problem check the build log, especially the linker calls. You can also post the build log here. Usually you will see linker complaining about incompatible libs or not found libs.

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

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @DQUY05 Build in debug mode and run through debugger. Then post the stack trace after crash here.

                  DQUY05D Offline
                  DQUY05D Offline
                  DQUY05
                  wrote on last edited by
                  #10

                  @jsulm said in Error due to Opencv but Qt does not show error message:

                  @DQUY05 Build in debug mode and run through debugger. Then post the stack trace after crash here.

                  Hi,
                  When run through debugger, it exits with this message

                  15:53:57: Debugging D:\DATA\QT\Du-an-Quy\Desktop\Build\debug\bai1.exe ...
                  15:53:58: Debugging of D:\DATA\QT\Du-an-Quy\Desktop\Build\debug\bai1.exe has finished with exit code 0.
                  

                  I'm still trying and desperately need MinGW with OpenCV, even though I've done it successfully before
                  Many thanks!

                  jsulmJ 1 Reply Last reply
                  0
                  • DQUY05D DQUY05

                    @jsulm said in Error due to Opencv but Qt does not show error message:

                    @DQUY05 Build in debug mode and run through debugger. Then post the stack trace after crash here.

                    Hi,
                    When run through debugger, it exits with this message

                    15:53:57: Debugging D:\DATA\QT\Du-an-Quy\Desktop\Build\debug\bai1.exe ...
                    15:53:58: Debugging of D:\DATA\QT\Du-an-Quy\Desktop\Build\debug\bai1.exe has finished with exit code 0.
                    

                    I'm still trying and desperately need MinGW with OpenCV, even though I've done it successfully before
                    Many thanks!

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

                    @DQUY05 said in Error due to Opencv but Qt does not show error message:

                    has finished with exit code 0

                    This looks like your app simply finishes without any errors. Is your app actually doing anything?

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

                    DQUY05D 1 Reply Last reply
                    2
                    • jsulmJ jsulm

                      @DQUY05 said in Error due to Opencv but Qt does not show error message:

                      has finished with exit code 0

                      This looks like your app simply finishes without any errors. Is your app actually doing anything?

                      DQUY05D Offline
                      DQUY05D Offline
                      DQUY05
                      wrote on last edited by
                      #12

                      @jsulm said in Error due to Opencv but Qt does not show error message:

                      @DQUY05 said in Error due to Opencv but Qt does not show error message:

                      has finished with exit code 0

                      This looks like your app simply finishes without any errors. Is your app actually doing anything?

                      Thank you for your help, I solved the problem, it is true that with MinGw64 it was necessary to use OpenCV64, I changed it, and had to restart the IDE, now it is working fine.
                      Many thanks !

                      1 Reply Last reply
                      0

                      • Login

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