Ask Your Question
0

Compile error when compiling for windows (3.4.1-dev)

asked 2018-06-01 04:07:56 -0600

pouya.1991 gravatar image

updated 2018-06-01 04:16:19 -0600

berak gravatar image

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>
edit retag flag offensive close merge delete

Comments

1
  • 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)
berak gravatar imageberak ( 2018-06-01 04:21:52 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2018-06-01 04:56:38 -0600

pouya.1991 gravatar image

A world of thanks I set WITH_IPP=OFF, WITH_MSMF=OFF and it complied successfully :)

edit flag offensive delete link more
0

answered 2018-09-06 08:19:38 -0600

Thank you so much! Was stuck with the same error for hours, finally solved!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-06-01 04:07:56 -0600

Seen: 4,500 times

Last updated: Jun 01 '18