Error due to Opencv but Qt does not show error message
-
wrote on 15 Oct 2021, 03:03 last edited by
Hi,
I use opencv, previously used it normally, but now when I start the program, it exits, but qt does not display an error message, but when I remove this commandusing namespace cv; using namespace std; VideoCapture capture;
, the program runs normally
this is the message from the Application Output window10:00:58: Starting D:\DATA\QT\Du-an-Quy\Desktop\CAMERA\Build\debug\bai1.exe ... 10:00:58: The program has unexpectedly finished. 10:00:58: The process was ended forcefully. 10:00:58: D:\DATA\QT\Du-an-Quy\Desktop\CAMERA\Build\debug\bai1.exe crashed.
And this is the message from the Compile Output window
10:00:48: Running steps for project bai1... 10:00:48: Starting: "C:\Qt\QT5.15\5.15.2\mingw81_64\bin\qmake.exe" D:\DATA\QT\Du-an-Quy\Desktop\CAMERA\bai1.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" 10:00:50: The process "C:\Qt\QT5.15\5.15.2\mingw81_64\bin\qmake.exe" exited normally. 10:00:50: Starting: "C:\Qt\QT5.15\Tools\mingw810_64\bin\mingw32-make.exe" -f D:/DATA/QT/Du-an-Quy/Desktop/CAMERA/Build/Makefile qmake_all mingw32-make: Nothing to be done for 'qmake_all'. 10:00:50: The process "C:\Qt\QT5.15\Tools\mingw810_64\bin\mingw32-make.exe" exited normally. 10:00:50: Starting: "C:\Qt\QT5.15\Tools\mingw810_64\bin\mingw32-make.exe" -j8 C:/Qt/QT5.15/Tools/mingw810_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'D:/DATA/QT/Du-an-Quy/Desktop/CAMERA/Build' g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_TESTLIB_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="\"D:/DATA/QT/Du-an-Quy/Desktop/CAMERA/Build\"" -I..\..\CAMERA -I. -IC:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\include -IC:\Qt\QT5.15\5.15.2\mingw81_64\include -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtMultimediaWidgets -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtMultimedia -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtWidgets -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtGui -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtANGLE -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtTest -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtNetwork -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtCore -Idebug -I. -I/include -IC:\Qt\QT5.15\5.15.2\mingw81_64\mkspecs\win32-g++ -o debug\mainwindow.o ..\mainwindow.cpp g++ -Wl,-subsystem,console -mthreads -o debug\bai1.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_core452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_highgui452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_imgproc452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_videoio452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_imgcodecs452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_features2d452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_video452.dll C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5MultimediaWidgets.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Multimedia.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Widgets.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Gui.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Test.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Network.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Core.a mingw32-make[1]: Leaving directory 'D:/DATA/QT/Du-an-Quy/Desktop/CAMERA/Build' 10:00:58: The process "C:\Qt\QT5.15\Tools\mingw810_64\bin\mingw32-make.exe" exited normally. 10:00:58: Elapsed time: 00:10.
Thanks !
-
Hi,
I use opencv, previously used it normally, but now when I start the program, it exits, but qt does not display an error message, but when I remove this commandusing namespace cv; using namespace std; VideoCapture capture;
, the program runs normally
this is the message from the Application Output window10:00:58: Starting D:\DATA\QT\Du-an-Quy\Desktop\CAMERA\Build\debug\bai1.exe ... 10:00:58: The program has unexpectedly finished. 10:00:58: The process was ended forcefully. 10:00:58: D:\DATA\QT\Du-an-Quy\Desktop\CAMERA\Build\debug\bai1.exe crashed.
And this is the message from the Compile Output window
10:00:48: Running steps for project bai1... 10:00:48: Starting: "C:\Qt\QT5.15\5.15.2\mingw81_64\bin\qmake.exe" D:\DATA\QT\Du-an-Quy\Desktop\CAMERA\bai1.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" 10:00:50: The process "C:\Qt\QT5.15\5.15.2\mingw81_64\bin\qmake.exe" exited normally. 10:00:50: Starting: "C:\Qt\QT5.15\Tools\mingw810_64\bin\mingw32-make.exe" -f D:/DATA/QT/Du-an-Quy/Desktop/CAMERA/Build/Makefile qmake_all mingw32-make: Nothing to be done for 'qmake_all'. 10:00:50: The process "C:\Qt\QT5.15\Tools\mingw810_64\bin\mingw32-make.exe" exited normally. 10:00:50: Starting: "C:\Qt\QT5.15\Tools\mingw810_64\bin\mingw32-make.exe" -j8 C:/Qt/QT5.15/Tools/mingw810_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'D:/DATA/QT/Du-an-Quy/Desktop/CAMERA/Build' g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_TESTLIB_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="\"D:/DATA/QT/Du-an-Quy/Desktop/CAMERA/Build\"" -I..\..\CAMERA -I. -IC:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\include -IC:\Qt\QT5.15\5.15.2\mingw81_64\include -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtMultimediaWidgets -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtMultimedia -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtWidgets -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtGui -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtANGLE -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtTest -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtNetwork -IC:\Qt\QT5.15\5.15.2\mingw81_64\include\QtCore -Idebug -I. -I/include -IC:\Qt\QT5.15\5.15.2\mingw81_64\mkspecs\win32-g++ -o debug\mainwindow.o ..\mainwindow.cpp g++ -Wl,-subsystem,console -mthreads -o debug\bai1.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_core452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_highgui452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_imgproc452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_videoio452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_imgcodecs452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_features2d452.dll C:\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin\libopencv_video452.dll C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5MultimediaWidgets.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Multimedia.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Widgets.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Gui.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Test.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Network.a C:\Qt\QT5.15\5.15.2\mingw81_64\lib\libQt5Core.a mingw32-make[1]: Leaving directory 'D:/DATA/QT/Du-an-Quy/Desktop/CAMERA/Build' 10:00:58: The process "C:\Qt\QT5.15\Tools\mingw810_64\bin\mingw32-make.exe" exited normally. 10:00:58: Elapsed time: 00:10.
Thanks !
@DQUY05 Build in debug mode and run through debugger. Then post the stack trace after crash here.
-
wrote on 15 Oct 2021, 07:35 last edited by
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 errorC:\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!
-
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 errorC:\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!
@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?
-
@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?
wrote on 15 Oct 2021, 07:56 last edited by@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! -
@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!@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.
-
@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.
wrote on 15 Oct 2021, 08:10 last edited by@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! -
@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!@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. -
@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!@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.
-
@DQUY05 Build in debug mode and run through debugger. Then post the stack trace after crash here.
wrote on 15 Oct 2021, 08:57 last edited by@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 message15: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! -
@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 message15: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!@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?
-
@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?
wrote on 16 Oct 2021, 01:00 last edited by@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/12