Compile error when compiling for windows (3.4.1-dev)
Hello I'm trying to compile opencv 3.4.1-dev for windows by using mingw32 but I get this error :
[ 64%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/padding_layer.cpp.obj
[ 64%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_vfw.cpp.obj
In file included from C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp:59:0:
C:/Qt/Qt5.9.1/Tools/mingw530_32/i686-w64-mingw32/include/mfplay.h:77:50: error: 'MFP_MEDIAITEM_CHARACTERISTICS' has not been declared
STDMETHOD_(HRESULT,GetCharacteristics)(THIS_ MFP_MEDIAITEM_CHARACTERISTICS *pCharacteristics) PURE;
^
C:/Qt/Qt5.9.1/Tools/mingw530_32/i686-w64-mingw32/include/mfplay.h:79:46: error: 'IMFPMediaPlayer' has not been declared
STDMETHOD_(HRESULT,GetMediaPlayer)(THIS_ IMFPMediaPlayer **ppMediaPlayer) PURE;
^
In file included from C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp:59:0:
C:/Qt/Qt5.9.1/Tools/mingw530_32/i686-w64-mingw32/include/mfplay.h:158:50: error: 'MFVideoNormalizedRect' has not been declared
STDMETHOD_(HRESULT,GetVideoSourceRect)(THIS_ MFVideoNormalizedRect *pnrcSource) PURE;
^
C:/Qt/Qt5.9.1/Tools/mingw530_32/i686-w64-mingw32/include/mfplay.h:173:56: error: 'MFVideoNormalizedRect' does not name a type
STDMETHOD_(HRESULT,SetVideoSourceRect)(THIS_ const MFVideoNormalizedRect *pnrcSource) PURE;
^
C:/Qt/Qt5.9.1/Tools/mingw530_32/i686-w64-mingw32/include/mfplay.h:241:41: error: 'MFP_EVENT_HEADER' has not been declared
STDMETHOD(OnMediaPlayerEvent)(THIS_ MFP_EVENT_HEADER *pEventHeader) PURE;
^
C:/Qt/Qt5.9.1/Tools/mingw530_32/i686-w64-mingw32/include/mfplay.h:333:3: error: 'MFP_CREDENTIAL_FLAGS' does not name a type
MFP_CREDENTIAL_FLAGS flags;
^
C:/Qt/Qt5.9.1/Tools/mingw530_32/i686-w64-mingw32/include/mfplay.h:334:3: error: 'IMFNetCredential' does not name a type
IMFNetCredential *pCredential;
^
C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp:213:35: error: '_Deref_out_opt_' has not been declared
_Check_return_ HRESULT CopyTo(_Deref_out_opt_ T** ppT)
^
C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp:213:51: error: declaration of 'int T'
_Check_return_ HRESULT CopyTo(_Deref_out_opt_ T** ppT)
^
C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp:136:11: error: shadows template parm 'class T'
template <class T>
^
C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp:213:52: error: expected ',' or '...' before '*' token
_Check_return_ HRESULT CopyTo(_Deref_out_opt_ T** ppT)
^
C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp: In member function 'HRESULT {anonymous}::ComPtr<T>::CopyTo(int)':
C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp:213:51: error: declaration of 'int T'
_Check_return_ HRESULT CopyTo(_Deref_out_opt_ T** ppT)
^
C:\opencv\opencv\modules\videoio\src\cap_msmf.cpp:136:11: error: shadows template parm 'class T'
template <class T>
Comments
- if you are using a 64 bit os, you should use mingw64, not the 32bit one (530 might also be too old !)
- you have to disable WITH_MFMS (media foundation needs special win sdk, only available for VS)
- ENABLE_PRECOMPILED_HEADERS=OFF
- WITH_IPP=OFF WITH_TBB=OFF (again libs available are for VS only)