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)
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
36 Posts 6 Posters 17.9k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #5

    You are missing opencv_core

    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
    • R Offline
      R Offline
      RodMckay
      wrote on last edited by
      #6

      thank you very much . I run at the end :D

      there is another problem , I think it's my fault but I know where is that

      Application Output :
      excited with code 0

      and I couldn't see my image , do u have any suggestions?

      I try to change .jpg with .png but again I couldn't see the image

      thanks again

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #7

        Are you sure cvWaitKey(0) is the right value ?

        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
        • R Offline
          R Offline
          RodMckay
          wrote on last edited by
          #8

          yes, it's value is right, now I don't know what I can do for the program

          just I wanted to write a simple program to start opencv but I couldn't

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #9

            AFAIK, cvWaitKey(0) will wait for 0 ms so your application will show/hide your image too fast for you to see

            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
            • R Offline
              R Offline
              RodMckay
              wrote on last edited by
              #10

              thanks for your reply but it doesn't show again , I'm tired to try that

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #11

                Use cvWaitKey(-1) so it won't timeout, also you should check whether opencv needs windows style path e.g.

                @IplImage* img = cvLoadImage("D:\image.jpg");@

                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
                • Negar_mgN Offline
                  Negar_mgN Offline
                  Negar_mg
                  wrote on last edited by
                  #12

                  Hi,
                  I followed this tutorial:
                  https://www.youtube.com/watch?v=ox6NFWE8xg4

                  this is my .pro file:

                  QT -= gui

                  CONFIG += c++11 console
                  CONFIG -= app_bundle

                  SOURCES +=
                  main.cpp

                  qnx: target.path = /tmp/$${TARGET}/bin
                  else: unix:!android: target.path = /opt/$${TARGET}/bin
                  !isEmpty(target.path): INSTALLS += target
                  INCLUDEPATH += C:\Qt\opencv_cv2\OPENCV1\include
                  LIBS += -LC:\Qt\opencv_cv2\OPENCV1\build-qt\lib
                  -lopencv_calib3d249d
                  -lopencv_contrib249d
                  -lopencv_core249d
                  -lopencv_features2d249d
                  -lopencv_flann249d
                  -lopencv_gpu249d
                  -lopencv_highgui249d
                  -lopencv_imgproc249d
                  -lopencv_legacy249d
                  -lopencv_ml249d
                  -lopencv_nonfree249d
                  -lopencv_objdetect249d
                  -lopencv_ocl249d
                  -lopencv_photo249d
                  -lopencv_stitching249d
                  -lopencv_superres249d
                  -lopencv_ts249d
                  -lopencv_video249d
                  -lopencv_videostab249d

                  this is my main file:

                  #include <iostream>

                  #include <opencv2/highgui/highgui.hpp>
                  #include <opencv2/imgproc/imgproc.hpp>
                  #include <opencv2/core/core.hpp>

                  using namespace cv;
                  using namespace std;

                  int main()
                  {
                  string imgloc="D:/ide/111.png";

                  Mat image = imread(imgloc);
                  

                  // Check for failure
                  if (image.empty())
                  {
                  cout << "Could not open or find the image" << endl;
                  return -1;
                  }

                  String windowName = "opencv"; //Name of the window
                  
                  namedWindow(windowName); // Create a window
                  
                  imshow(windowName, image); // Show our image inside the created window.
                  
                  waitKey(0); // Wait for any keystroke in the window
                  
                  
                  return 0;
                  

                  }

                  and this is my log output:

                  14:38:00: Running steps for project opencvtest10...
                  14:38:00: Starting: "C:\Qt\Qt5.12.11\5.12.11\mingw73_32\bin\qmake.exe" C:\Users\test\Documents\opencvtest10\opencvtest10.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
                  Info: creating stash file C:\Users\test\Documents\build-opencvtest10-Desktop_Qt_5_12_11_MinGW_32_bit-Debug.qmake.stash
                  14:38:04: The process "C:\Qt\Qt5.12.11\5.12.11\mingw73_32\bin\qmake.exe" exited normally.
                  14:38:04: Starting: "C:\Qt\Qt5.12.11\Tools\mingw730_32\bin\mingw32-make.exe" -f C:/Users/test/Documents/build-opencvtest10-Desktop_Qt_5_12_11_MinGW_32_bit-Debug/Makefile qmake_all
                  mingw32-make: Nothing to be done for 'qmake_all'.
                  14:38:05: The process "C:\Qt\Qt5.12.11\Tools\mingw730_32\bin\mingw32-make.exe" exited normally.
                  14:38:05: Starting: "C:\Qt\Qt5.12.11\Tools\mingw730_32\bin\mingw32-make.exe" -j4
                  C:/Qt/Qt5.12.11/Tools/mingw730_32/bin/mingw32-make -f Makefile.Debug
                  mingw32-make[1]: Entering directory 'C:/Users/test/Documents/build-opencvtest10-Desktop_Qt_5_12_11_MinGW_32_bit-Debug'
                  g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_CORE_LIB -I..\opencvtest10 -I. -I........\Qt\opencv_cv2\OPENCV1\include -I........\Qt\Qt5.12.11\5.12.11\mingw73_32\include -I........\Qt\Qt5.12.11\5.12.11\mingw73_32\include\QtCore -Idebug -I........\Qt\Qt5.12.11\5.12.11\mingw73_32\mkspecs\win32-g++ -o debug\main.o ..\opencvtest10\main.cpp
                  g++ -Wl,-subsystem,console -mthreads -o debug\opencvtest10.exe debug/main.o -LC:\Qt\opencv_cv2\OPENCV1\build-qt\lib -lopencv_calib3d249d -lopencv_contrib249d -lopencv_core249d -lopencv_features2d249d -lopencv_flann249d -lopencv_gpu249d -lopencv_highgui249d -lopencv_imgproc249d -lopencv_legacy249d -lopencv_ml249d -lopencv_nonfree249d -lopencv_objdetect249d -lopencv_ocl249d -lopencv_photo249d -lopencv_stitching249d -lopencv_superres249d -lopencv_ts249d -lopencv_video249d -lopencv_videostab249d C:\Qt\Qt5.12.11\5.12.11\mingw73_32\lib\libQt5Cored.a
                  debug/main.o: In function main': C:\Users\test\Documents\build-opencvtest10-Desktop_Qt_5_12_11_MinGW_32_bit-Debug/../opencvtest10/main.cpp:14: undefined reference to cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
                  C:\Users\test\Documents\build-opencvtest10-Desktop_Qt_5_12_11_MinGW_32_bit-Debug/../opencvtest10/main.cpp:25: undefined reference to cv::namedWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' C:\Users\test\Documents\build-opencvtest10-Desktop_Qt_5_12_11_MinGW_32_bit-Debug/../opencvtest10/main.cpp:27: undefined reference to cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
                  collect2.exe: error: ld returned 1 exit status
                  mingw32-make[1]: *** [Makefile.Debug:65: debug/opencvtest10.exe] Error 1
                  mingw32-make: *** [Makefile:38: debug] Error 2
                  mingw32-make[1]: Leaving directory 'C:/Users/test/Documents/build-opencvtest10-Desktop_Qt_5_12_11_MinGW_32_bit-Debug'
                  14:38:13: The process "C:\Qt\Qt5.12.11\Tools\mingw730_32\bin\mingw32-make.exe" exited with code 2.
                  Error while building/deploying project opencvtest10 (kit: Desktop Qt 5.12.11 MinGW 32-bit)
                  When executing step "Make"
                  14:38:13: Elapsed time: 00:13.

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

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13

                    Hi and welcome to devnet,

                    Do you have OpenCV built for the correct architecture ?
                    Is it built with MinGW ?

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

                    mrjjM 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      Hi and welcome to devnet,

                      Do you have OpenCV built for the correct architecture ?
                      Is it built with MinGW ?

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #14

                      @SGaist

                      Hi
                      The video contains links to a Qt build version it seems. ( 3rd link in the text below)
                      But its for 5.4 ( and seems to contain virus/unclean ) so I could not check what
                      was actually inside.

                      and it seems the poster is using
                      Qt5.12.11 so I guess that is why it won't link.

                      @Negar_mg

                      I think you might have better luck with
                      https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows
                      The other video is using something that is really old.

                      Unless it must be Qt 54. ofc. even if very, very old.

                      1 Reply Last reply
                      0
                      • Negar_mgN Offline
                        Negar_mgN Offline
                        Negar_mg
                        wrote on last edited by Negar_mg
                        #15

                        i am using
                        Qt5.12.11 ,
                        OpenCV-2.4.9- Qt 5.4,
                        opencv-4.5.2-vc14_vc15
                        windows10

                        i did that link's steps but i have some errors in cmake.
                        this is logs:

                        {
                        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
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #16

                          What exactly are you trying to build ?

                          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
                          • Negar_mgN Offline
                            Negar_mgN Offline
                            Negar_mg
                            wrote on last edited by
                            #17

                            I want to write a program to display an image or video from a webcam using Qt and Open CV.
                            But I was not able to add Open CV to QT. When I used the following link, I encountered those errors in CMake.
                            /................................................................................................
                            https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows
                            /...............................................................................................
                            And when I used the link from YouTube that I sent in the first comment, I encountered those errors in Qt.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #18

                              From the looks of it, the OpenCV 4 you downloaded is built with Visual Studio, thus you have to use a Visual Studio build of Qt as well as mixing C++ compilers is not possible.

                              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
                              • Negar_mgN Offline
                                Negar_mgN Offline
                                Negar_mg
                                wrote on last edited by
                                #19

                                You mean you think I can not use opencv with Qt?
                                Is there no way?

                                jsulmJ 1 Reply Last reply
                                0
                                • Negar_mgN Negar_mg

                                  You mean you think I can not use opencv with Qt?
                                  Is there no way?

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

                                  @Negar_mg said in Error: undefined reference to &#x60;cvReleaseImage' (opencv + Qt):

                                  You mean you think I can not use opencv with Qt?

                                  No, that's not what @SGaist means.
                                  What he means is that you can't mix binaries built with different C++ compilers.
                                  And because OpenCV you downloaded was built using compiler from Microsoft Visual Studio you also need Qt built with this compiler. So, simply install MSVC2017 or MSVC2019 Qt.

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

                                  1 Reply Last reply
                                  2
                                  • Negar_mgN Offline
                                    Negar_mgN Offline
                                    Negar_mg
                                    wrote on last edited by
                                    #21

                                    thanks alot :)

                                    1 Reply Last reply
                                    0
                                    • Negar_mgN Offline
                                      Negar_mgN Offline
                                      Negar_mg
                                      wrote on last edited by
                                      #22

                                      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.

                                      jsulmJ 1 Reply Last reply
                                      0
                                      • Negar_mgN Negar_mg

                                        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.

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

                                        @Negar_mg said in Error: undefined reference to &#x60;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
                                        • Negar_mgN Offline
                                          Negar_mgN Offline
                                          Negar_mg
                                          wrote on 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?

                                          jsulmJ 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