Ask Your Question
0

Install opencv 4.0 with eclipse on Windows- Error during Build

asked 2018-12-14 20:21:47 -0600

inn@nav8 gravatar image

updated 2018-12-16 08:26:41 -0600

berak gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

Comments

please edit your question and SHOW us the actual errors (then we can help !)

berak gravatar imageberak ( 2018-12-14 21:21:09 -0600 )edit

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

inn@nav8 gravatar imageinn@nav8 ( 2018-12-15 20:10:08 -0600 )edit

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)

How to attach the file in the forum?

just paste the text there.

berak gravatar imageberak ( 2018-12-16 01:21:25 -0600 )edit

please use those cmake flags for mingw:

ENABLE_PRECOMPILED_HEADERS=OFF
WITH_MSMF=OFF
CPU_DISPATCH=""
berak gravatar imageberak ( 2018-12-16 01:49:47 -0600 )edit
1

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.

inn@nav8 gravatar imageinn@nav8 ( 2018-12-16 08:10:11 -0600 )edit

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:

WITH_MSMF=OFF
CPU_DISPATCH=""

then it should build fine. (i'm using ming64 7.2.0, too)

berak gravatar imageberak ( 2018-12-16 08:27:57 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-12-19 09:53:43 -0600

inn@nav8 gravatar image

Yeah thanks for your help. Its working now! I am able to use the OPENCV4.0 successfully. But, by turning off the MSMF will this have limited functionality and whats the functionality usage of MSMF.

edit flag offensive delete link more

Comments

it's an alternative webcam backend (to the venerable, but still working directshow one)

berak gravatar imageberak ( 2018-12-19 10:02:02 -0600 )edit

So MSMF is related to webcam functionality, Since i have turned off this now will this impact in future if i plan to use some webcam application.

inn@nav8 gravatar imageinn@nav8 ( 2018-12-19 19:20:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-12-14 20:21:47 -0600

Seen: 683 times

Last updated: Dec 16 '18