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: undefined reference to `cvReleaseImage' (opencv + Qt)
QtWS25 Last Chance

Error: undefined reference to `cvReleaseImage' (opencv + Qt)

Scheduled Pinned Locked Moved General and Desktop
36 Posts 6 Posters 17.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.
  • N Negar_mg
    29 Jun 2021, 06:46

    If I understand correctly, there are 2 ways to solve this issue:

    1- use vc compiler in qt to compile my codes.

    Here is a link I found for that, please let me know if it is correct:

    https://stackoverflow.com/questions/47773289/debugging-in-qtcreator-using-msvc2017-compiler

    2- download and compile opencv using qt compiler, and then refering to that folder in my qt.
    Is this compiler called minWG?
    Please give me a link or instruction on how to do that.

    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 29 Jun 2021, 07:06 last edited by
    #23

    @Negar_mg said in Error: undefined reference to `cvReleaseImage' (opencv + Qt):

    Is this compiler called minWG?

    I don't know what compiler you are using. This is something you should know.

    To use Visual Studio compiler you first need to install Visual Studio together with C++ tools. You can use the free Community edition. Then install Qt for that Visual Studio version. Then you should have a Kit in QtCreator configured to use Visual Studio compiler. The link you posted looks legit, just download more recent Qt version.

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

    1 Reply Last reply
    0
    • N Offline
      N Offline
      Negar_mg
      wrote on 29 Jun 2021, 07:19 last edited by
      #24

      I do not need vs and i have uninstalled it
      But i still get the error mentioned above
      How can i install opencv on qt without visual studio?

      J 1 Reply Last reply 29 Jun 2021, 07:22
      0
      • N Negar_mg
        29 Jun 2021, 07:19

        I do not need vs and i have uninstalled it
        But i still get the error mentioned above
        How can i install opencv on qt without visual studio?

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 29 Jun 2021, 07:22 last edited by
        #25

        @Negar_mg Build OpenCV using the compiler you're using with Qt...
        @mrjj Already gave you a link: https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows
        Also there is official OpenCV documentation for that: https://docs.opencv.org/3.4/d3/d52/tutorial_windows_install.html

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

        1 Reply Last reply
        1
        • N Offline
          N Offline
          Negar_mg
          wrote on 29 Jun 2021, 07:40 last edited by
          #26

          I have followed the steps in the link you provided, but cmake step raised some errors. Its log is bellow:

          Log:
          {sizeof(void) = 4 on 64 bit processor. Assume 32-bit compilation mode
          Found PythonInterp: C:/Users/test/AppData/Local/Programs/Python/Python37/python.exe (found suitable version "3.7", minimum required is "2.7")
          CMake Warning at cmake/OpenCVDetectPython.cmake:81 (message):
          CMake's 'find_host_package(PythonInterp 2.7)' found wrong Python version:
          PYTHON_EXECUTABLE=C:/Users/test/AppData/Local/Programs/Python/Python37/python.exe
          PYTHON_VERSION_STRING=3.7
          Consider providing the 'PYTHON2_EXECUTABLE' variable via CMake command line
          or environment variables
          Call Stack (most recent call first):
          cmake/OpenCVDetectPython.cmake:271 (find_python)
          CMakeLists.txt:614 (include)
          Could NOT find Python2 (missing: Python2_EXECUTABLE Interpreter)
          Reason given by package:
          Interpreter: Wrong major version for the interpreter "C:/Users/test/AppData/Local/Programs/Python/Python37/python.exe"
          }
          //..............................
          {
          Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH - Failed
          Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
          VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
          ADE: Download: v0.1.1f.zip
          Try 1 failed
          CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
          ADE: Download failed: 35;"SSL connect error"
          For details please refer to the download log file:
          C:/Qt/opencv_cv2/opencv/release/CMakeDownloadLog.txt
          Call Stack (most recent call first):
          modules/gapi/cmake/DownloadADE.cmake:5 (ocv_download)
          modules/gapi/cmake/init.cmake:19 (include)
          cmake/OpenCVModule.cmake:298 (include)
          cmake/OpenCVModule.cmake:361 (_add_modules_1)
          modules/CMakeLists.txt:7 (ocv_glob_modules)
          OpenCV Python: during development append to PYTHONPATH: C:/Qt/opencv_cv2/opencv/release/python_loader
          Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
          FFMPEG: Download: opencv_videoio_ffmpeg.dll
          Try 1 failed
          CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
          FFMPEG: Download failed: 35;"SSL connect error"
          For details please refer to the download log file:
          C:/Qt/opencv_cv2/opencv/release/CMakeDownloadLog.txt
          Call Stack (most recent call first):
          3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
          modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
          modules/videoio/cmake/init.cmake:7 (include)
          modules/videoio/cmake/init.cmake:18 (add_backend)
          cmake/OpenCVModule.cmake:298 (include)
          cmake/OpenCVModule.cmake:361 (_add_modules_1)
          modules/CMakeLists.txt:7 (ocv_glob_modules)
          FFMPEG: Download: opencv_videoio_ffmpeg_64.dll
          Try 1 failed
          CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
          FFMPEG: Download failed: 35;"SSL connect error"
          For details please refer to the download log file:
          C:/Qt/opencv_cv2/opencv/release/CMakeDownloadLog.txt
          Call Stack (most recent call first):
          3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
          modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
          modules/videoio/cmake/init.cmake:7 (include)
          modules/videoio/cmake/init.cmake:18 (add_backend)
          cmake/OpenCVModule.cmake:298 (include)
          cmake/OpenCVModule.cmake:361 (_add_modules_1)
          modules/CMakeLists.txt:7 (ocv_glob_modules)
          FFMPEG: Download: ffmpeg_version.cmake
          Try 1 failed
          CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
          FFMPEG: Download failed: 35;"SSL connect error"
          For details please refer to the download log file:
          C:/Qt/opencv_cv2/opencv/release/CMakeDownloadLog.txt
          Call Stack (most recent call first):
          3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
          modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
          modules/videoio/cmake/init.cmake:7 (include)
          modules/videoio/cmake/init.cmake:18 (add_backend)
          cmake/OpenCVModule.cmake:298 (include)
          cmake/OpenCVModule.cmake:361 (_add_modules_1)
          modules/CMakeLists.txt:7 (ocv_glob_modules)
          }
          //........................................
          {
          Performing Test HAVE_CXX_WNO_UNUSED_PRIVATE_FIELD - Failed
          CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
          CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
          directory
          Call Stack (most recent call first):
          CMakeLists.txt:1010 (include)
          }

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on 29 Jun 2021, 07:42 last edited by
            #27

            Hi
            Could you try with python 2.7 instead?

            It seems to complain about the 3.7 version

            CMake's 'find_host_package(PythonInterp 2.7)' found wrong Python version:
            Could NOT find Python2 (missing: Python2_EXECUTABLE Interpreter)
            Wrong major version for the interpreter "C:/Users/test/AppData/Local/Programs/Python/Python37/python.exe"

            1 Reply Last reply
            0
            • N Offline
              N Offline
              Negar_mg
              wrote on 29 Jun 2021, 08:22 last edited by
              #28

              How can i try it with python 2.7? What should i change in tutorial steps?

              J mrjjM 2 Replies Last reply 29 Jun 2021, 08:24
              0
              • N Negar_mg
                29 Jun 2021, 08:22

                How can i try it with python 2.7? What should i change in tutorial steps?

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 29 Jun 2021, 08:24 last edited by
                #29

                @Negar_mg You should install Python 2.7

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

                1 Reply Last reply
                0
                • N Negar_mg
                  29 Jun 2021, 08:22

                  How can i try it with python 2.7? What should i change in tutorial steps?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 29 Jun 2021, 08:25 last edited by
                  #30

                  @Negar_mg

                  All steps the same.
                  Simply install python 2.7 and see if it then
                  sounds happier

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    Negar_mg
                    wrote on 29 Jun 2021, 09:05 last edited by
                    #31

                    I installed Python 2.7, checked that it was installed with the python -v command in cmd, then according to this link

                    //...........................................................................................

                    https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows
                    //...........................................................................................
                    In cmake, I selected the source and destination, but after clicking the configure button, I encountered these errors:
                    //...........................................................................................
                    {
                    Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH - Failed
                    Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
                    VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
                    ADE: Download: v0.1.1f.zip
                    Try 1 failed
                    CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
                    ADE: Download failed: 35;"SSL connect error"

                    For details please refer to the download log file:

                    C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt

                    Call Stack (most recent call first):
                    modules/gapi/cmake/DownloadADE.cmake:5 (ocv_download)
                    modules/gapi/cmake/init.cmake:19 (include)
                    cmake/OpenCVModule.cmake:298 (include)
                    cmake/OpenCVModule.cmake:361 (_add_modules_1)
                    modules/CMakeLists.txt:7 (ocv_glob_modules)

                    OpenCV Python: during development append to PYTHONPATH: C:/Qt/opencv_cv2/opencv/Release/python_loader
                    Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
                    FFMPEG: Download: opencv_videoio_ffmpeg.dll
                    Try 1 failed
                    CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
                    FFMPEG: Download failed: 35;"SSL connect error"

                    For details please refer to the download log file:

                    C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt

                    Call Stack (most recent call first):
                    3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
                    modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
                    modules/videoio/cmake/init.cmake:7 (include)
                    modules/videoio/cmake/init.cmake:18 (add_backend)
                    cmake/OpenCVModule.cmake:298 (include)
                    cmake/OpenCVModule.cmake:361 (_add_modules_1)
                    modules/CMakeLists.txt:7 (ocv_glob_modules)

                    FFMPEG: Download: opencv_videoio_ffmpeg_64.dll
                    Try 1 failed
                    CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
                    FFMPEG: Download failed: 35;"SSL connect error"

                    For details please refer to the download log file:

                    C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt

                    Call Stack (most recent call first):
                    3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
                    modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
                    modules/videoio/cmake/init.cmake:7 (include)
                    modules/videoio/cmake/init.cmake:18 (add_backend)
                    cmake/OpenCVModule.cmake:298 (include)
                    cmake/OpenCVModule.cmake:361 (_add_modules_1)
                    modules/CMakeLists.txt:7 (ocv_glob_modules)

                    FFMPEG: Download: ffmpeg_version.cmake
                    Try 1 failed
                    CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
                    FFMPEG: Download failed: 35;"SSL connect error"

                    For details please refer to the download log file:

                    C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt

                    Call Stack (most recent call first):
                    3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
                    modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
                    modules/videoio/cmake/init.cmake:7 (include)
                    modules/videoio/cmake/init.cmake:18 (add_backend)
                    cmake/OpenCVModule.cmake:298 (include)
                    cmake/OpenCVModule.cmake:361 (_add_modules_1)
                    modules/CMakeLists.txt:7 (ocv_glob_modules)

                    }

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      Negar_mg
                      wrote on 30 Jun 2021, 04:49 last edited by Negar_mg
                      #32

                      @mrjj ,
                      @SGaist
                      Please Help me ,
                      How can I fix these errors?

                      J 1 Reply Last reply 30 Jun 2021, 04:54
                      0
                      • N Negar_mg
                        30 Jun 2021, 04:49

                        @mrjj ,
                        @SGaist
                        Please Help me ,
                        How can I fix these errors?

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 30 Jun 2021, 04:54 last edited by
                        #33

                        @Negar_mg I don't know how. This is an OpenCV issue and has nothing to do with Qt. Please ask in an OpenCV forum.

                        You should at least consider doing what the error output suggests:
                        "For details please refer to the download log file:

                        C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt"
                        It looks like it can't download some dependencies.

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

                        1 Reply Last reply
                        0
                        • N Offline
                          N Offline
                          Negar_mg
                          wrote on 30 Jun 2021, 05:57 last edited by
                          #34

                          Yes. I know that it cannot download a link, but i have no idea how to fix it. Could you please give me a hint

                          «Error»
                          {
                          ADE: Download: v0.1.1f.zip
                          Try 1 failed
                          CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
                          ADE: Download failed: 35;"SSL connect error"

                          For details please refer to the download log file:

                          C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt

                          Call Stack (most recent call first):
                          modules/gapi/cmake/DownloadADE.cmake:5 (ocv_download)
                          modules/gapi/cmake/init.cmake:19 (include)
                          cmake/OpenCVModule.cmake:298 (include)
                          cmake/OpenCVModule.cmake:361 (_add_modules_1)
                          modules/CMakeLists.txt:7 (ocv_glob_modules)

                          }

                          J 1 Reply Last reply 30 Jun 2021, 11:14
                          0
                          • N Negar_mg
                            30 Jun 2021, 05:57

                            Yes. I know that it cannot download a link, but i have no idea how to fix it. Could you please give me a hint

                            «Error»
                            {
                            ADE: Download: v0.1.1f.zip
                            Try 1 failed
                            CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
                            ADE: Download failed: 35;"SSL connect error"

                            For details please refer to the download log file:

                            C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt

                            Call Stack (most recent call first):
                            modules/gapi/cmake/DownloadADE.cmake:5 (ocv_download)
                            modules/gapi/cmake/init.cmake:19 (include)
                            cmake/OpenCVModule.cmake:298 (include)
                            cmake/OpenCVModule.cmake:361 (_add_modules_1)
                            modules/CMakeLists.txt:7 (ocv_glob_modules)

                            }

                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 30 Jun 2021, 11:14 last edited by
                            #35

                            @Negar_mg I never built OpenCV and this is Qt forum, not OpenCV.

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

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              daleberlin
                              wrote on 27 Mar 2023, 04:50 last edited by
                              #36

                              @RodMckay said in Error: undefined reference to `cvReleaseImage' (opencv + Qt):

                              I try to write a simple image viewer program by using opencv int Qt5.1
                              the problem is that Qt5.1 shows me the error in runtime , where am I wrong ?
                              .pro
                              @
                              #-------------------------------------------------

                              Project created by QtCreator 2013-09-11T03:55:37

                              #-------------------------------------------------
                              QT += core
                              QT -= gui
                              TARGET = camera_onConsole
                              CONFIG += console
                              CONFIG -= app_bundle
                              TEMPLATE = app
                              INCLUDEPATH += D:\opencv\build\include
                              LIBS += -lopencv_highgui246
                              -lopencv_imgproc246
                              -lopencv_objdetect246
                              SOURCES += main.cpp
                              @
                              .cpp
                              @
                              #include <QCoreApplication>
                              #include "opencv/cv.h"
                              #include "opencv/highgui.h"
                              #include <opencv/cxcore.h>
                              int main(int argc, char argv[])
                              {
                              QCoreApplication a(argc, argv);
                              IplImage
                              img = cvLoadImage("D:/image.jpg");
                              cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
                              cvShowImage("Example1", img);
                              cvWaitKey(0);
                              cvReleaseImage(&img);
                              cvDestroyWindow( "Example1" );
                              return a.exec();

                              }
                              @
                              is there anyone who knows solution of this ? thanks for replies

                              The error in the runtime could be due to various reasons, and it would be helpful if you could provide more information about the specific error message or behavior that you are encountering.

                              However, based on the code that you have provided, there are a few issues that might be causing the problem:

                              The Qt project file (.pro) is missing the inclusion of the "widgets" module, which is required for creating GUI applications. You can add it by modifying the "QT" line in your .pro file to:

                              QT += core widgets

                              The OpenCV library that you are linking to is version 2.4.6, which might not be compatible with the version of Qt that you are using (Qt 5.1). You could try linking to a more recent version of OpenCV (e.g., 4.x), or using an older version of Qt that is compatible with OpenCV 2.4.6.

                              The use of the "IplImage" data type is deprecated in newer versions of OpenCV, and you might encounter compatibility issues when using it with Qt. You could try using the newer "cv::Mat" data type instead, which is recommended for working with images in OpenCV.

                              Here is a modified version of your code that addresses these issues:

                              .pro
                              @
                              #-------------------------------------------------

                              Project created by QtCreator 2013-09-11T03:55:37
                              #-------------------------------------------------

                              QT += core widgets

                              TARGET = camera_onConsole
                              CONFIG += console
                              CONFIG -= app_bundle

                              TEMPLATE = app

                              INCLUDEPATH += D:\opencv\build\include

                              LIBS += -lopencv_highgui
                              -lopencv_imgproc
                              -lopencv_objdetect

                              SOURCES += main.cpp

                              @

                              .cpp
                              @
                              #include <QCoreApplication>
                              #include <opencv2/core.hpp>
                              #include <opencv2/highgui.hpp>

                              int main(int argc, char *argv[])
                              {
                              QCoreApplication a(argc, argv);

                              cv::Mat img = cv::imread("D:/image.jpg");
                              cv::namedWindow("Example1", cv::WINDOW_AUTOSIZE);
                              cv::imshow("Example1", img);
                              cv::waitKey(0);
                              cv::destroyWindow("Example1");
                              
                              return a.exec();
                              
                              

                              }

                              @

                              Note that this code uses the newer "cv::Mat" data type instead of "IplImage", and also uses the updated function names for creating and destroying windows in OpenCV.

                              1 Reply Last reply
                              0
                              • SGaistS SGaist moved this topic from Qt in Education on 27 Mar 2023, 19:44

                              • Login

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