Error: undefined reference to `cvReleaseImage' (opencv + Qt)
-
Hi and welcome to devnet,
Do you have OpenCV built for the correct architecture ?
Is it built with MinGW ?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.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.
-
i am using
Qt5.12.11 ,
OpenCV-2.4.9- Qt 5.4,
opencv-4.5.2-vc14_vc15
windows10i 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 variablesCall 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)}
-
What exactly are you trying to build ?
-
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. -
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.
-
@Negar_mg said in Error: undefined reference to `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. -
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. -
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.@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.
-
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?@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 -
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)
} -
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" -
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)}
-
@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.