Install opencv 4.0 with eclipse on Windows- Error during Build
Hello All,
I have installed opencv4.0 on windows. I am compiling OPENCV using CMAKE, I have configured and generated successfully in CMAKE. When i am building using mingw32-make its throwing errors. Can anyone help me in building successfully.
Below is the error which i am facing when i build with an command mingw32-make:
In file included from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/winbase.h:2377:0,
from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/windows.h:70,
from E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\precomp.hpp:76,
from E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:41:
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp: In member function 'virtual bool CvVideoWriter_MSMF::open(const String&, int, double, cv::Size, bool)':
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:2090:37: error: 'MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS' was not declared in this scope
SUCCEEDED(spAttr->SetUINT32(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, true)) &&
^
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:2091:37: error: 'MF_SINK_WRITER_DISABLE_THROTTLING' was not declared in this scope
SUCCEEDED(spAttr->SetUINT32(MF_SINK_WRITER_DISABLE_THROTTLING, true))
^
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:2091:37: note: suggested alternative: 'MF_SINK_WRITER_STATISTICS'
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp: In instantiation of '{anonymous}::ComPtr<T>::ComPtr(T*) [with T = IMFSourceReader]':
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:758:17: required from here
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:135:9: error: using invalid field '{anonymous}::ComPtr<T>::p'
p = lp;
^
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp: In instantiation of '{anonymous}::ComPtr<T>::ComPtr(T*) [with T = IMFSample]':
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:758:17: required from here
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:135:9: error: using invalid field '{anonymous}::ComPtr<T>::p'
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp: In instantiation of 'void {anonymous}::ComPtr<T>::Release() [with T = IMFSample]':
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:774:29: required from here
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:167:13: error: using invalid field '{anonymous}::ComPtr<T>::p'
if (p)
^
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:168:13: error: using invalid field '{anonymous}::ComPtr<T>::p'
p.Release();
^
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp: In instantiation of 'void {anonymous}::ComPtr<T>::Release() [with T = IMFSourceReader]':
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:775:33: required from here
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:167:13: error: using invalid field '{anonymous}::ComPtr<T>::p'
if (p)
^
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:168:13: error: using invalid field '{anonymous}::ComPtr<T>::p'
p.Release();
^
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp: In instantiation of 'void {anonymous}::ComPtr<T>::Release() [with T = IMFSourceReaderCallback]':
E:\opencv_ext_4.0\opencv\sources\modules\videoio\src\cap_msmf.cpp:779:26: required from here ...
please edit your question and SHOW us the actual errors (then we can help !)
Thanks for the response. How to attach the file in the forum? Anyways i am copying the last few line of errors manually. Below is the error list,
mingw32-make[2]: * [modules\videoio\CMakeFiles\opencv_videoio.dir\build.make:263: modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_msmf.cpp.obj] Error 1 mingw32-make[1]: [CMakeFiles\Makefile2:4159: modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 mingw32-make: ** [Makefile:162: all] Error 2
what you show is not the actual error, which must be a few lines up in the output. can you look again ?
and which
gcc --version
is used ?(also please put code / errors into your QUESTION as requested, not into comments)
just paste the text there.
please use those cmake flags for mingw:
I have pasted the error in the QUESTION now. gcc version i am using is 7.2.0
i have set PRECOMPILE HEADERS to off in CMAKE gui.
it is still trying to compile the MSMF video backend, and fails there (mingw is lacking some headers for it), so you have to disable thatfrom cmake:
then it should build fine. (i'm using ming64 7.2.0, too)