Ask Your Question

OpenCV 3.4.1 & GCC5.1.0 with codeblocks in windows

asked 2018-05-18 04:04:14 -0500

pranan gravatar image

updated 2018-05-18 04:07:29 -0500

berak gravatar image

Does this combination works ? OpenCV 3.4.1 + Contrib & GCC5.1.0 with codeblocks in windows. I am getting several errors while compiling. In cmake I have disabled matlab, examples, java, python, proto, vtk, ipp, precompiled headers. This is because I was getting different errors, and disabled these to clear one by one errors. Now at the stage of 43% of compilation I get error, which I have copied below. Request for inputs to sort out the error. Any suggestion on the tools combination?

C:\Users\user\Desktop\tool\OCV34\opencv_contrib-master\modules\phase_unwrapping\src\histogramphaseunwrapping.cpp:54:46: error: 'CV_OVERRIDE' does not name a type
     virtual ~HistogramPhaseUnwrapping_Impl() CV_OVERRIDE {};
C:\Users\user\Desktop\tool\OCV34\opencv_contrib-master\modules\phase_unwrapping\src\histogramphaseunwrapping.cpp:58:60: error: expected ';' at end of member declaration
                          InputArray shadowMask = noArray() ) CV_OVERRIDE;
C:\Users\user\Desktop\tool\OCV34\opencv_contrib-master\modules\phase_unwrapping\src\histogramphaseunwrapping.cpp:58:62: error: 'CV_OVERRIDE' does not name a type
                          InputArray shadowMask = noArray() ) CV_OVERRIDE;
C:\Users\user\Desktop\tool\OCV34\opencv_contrib-master\modules\phase_unwrapping\src\histogramphaseunwrapping.cpp:60:63: error: expected ';' at end of member declaration
     void getInverseReliabilityMap( OutputArray reliabilityMap ) CV_OVERRIDE;
C:\Users\user\Desktop\tool\OCV34\opencv_contrib-master\modules\phase_unwrapping\src\histogramphaseunwrapping.cpp:60:65: error: 'CV_OVERRIDE' does not name a type
     void getInverseReliabilityMap( OutputArray reliabilityMap ) CV_OVERRIDE;

mingw32-make.exe[2]: *** [modules/phase_unwrapping/CMakeFiles/opencv_phase_unwrapping.dir/src/histogramphaseunwrapping.cpp.obj] Error 1
mingw32-make.exe[1]: *** [modules/phase_unwrapping/CMakeFiles/opencv_phase_unwrapping.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
modules\phase_unwrapping\CMakeFiles\opencv_phase_unwrapping.dir\build.make:54: recipe for target 'modules/phase_unwrapping/CMakeFiles/opencv_phase_unwrapping.dir/src/histogramphaseunwrapping.cpp.obj' failed
mingw32-make.exe[2]: Leaving directory 'C:/opencv34/myBuild'
CMakeFiles\Makefile2:2861: recipe for target 'modules/phase_unwrapping/CMakeFiles/opencv_phase_unwrapping.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/opencv34/myBuild'
C:/opencv34/myBuild/Makefile:145: recipe for target 'all' failed
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-05-18 04:11:16 -0500

berak gravatar image

updated 2018-05-18 04:21:55 -0500

OpenCV 3.4.1 + Contrib

you need EXACTLY the same version for both opencv main and contrib repos.

opencv4 (master branch) uses c++11, things like override and final, and your 3.4.1 opencv main branch does not. (or, lacks the macro definitions)

either update your opencv main repo (and see, you have c++11 enabled in cmake(ENABLE_CXX11)), or use the 3.4.1 opencv_contrib branch (if you downloaded that via git, that's just a git checkout 3.4.1)

edit flag offensive delete link more


Thank you for the immediate response As recommended I made with same versions of openCV and Contrib reps. With that now I get error in the following files (TDM-GCC-5.1.0, CMAKE 3.11.2 along with codeblocks) And there are about 50 errors in the file of similar nature. Request for help and Thanks in advance

modules\videoio\src\cap_msmf.cpp:59:0: C:/TDM-GCC-64/x86_64-w64-mingw32/include/mfplay.h:77:50: error: 'MFP_MEDIAITEM_CHARACTERISTICS' has not been declared STDMETHOD_(HRESULT,GetCharacteristics)(THIS_ MFP_MEDIAITEM_CHARACTERISTICS *pCharacteristics) PURE;

pranan gravatar imagepranan ( 2018-05-18 10:54:00 -0500 )edit

i don't think, you can compile the msmf (media foundation) framework with mingw out-of-the-box (iirc, it needs an extra sdk from ms)

try to disable it :


(or the checkbox somewhere at the bottom in cmake-gui)

berak gravatar imageberak ( 2018-05-18 11:11:00 -0500 )edit

(1) I could finish compile and install by setting VIDEOIO OFF, I do not know the effect of this, testing pending. Any idea on the effect of this?

(2) Before getting this there was one more error (I have copied the message below). I could overcome the error by disabling IPP (OFF). But could you tell how to enable IPP and compile?

pranan gravatar imagepranan ( 2018-05-18 12:11:15 -0500 )edit

(1) that's probably a bad idea. i think, you'll need a webcam or reading/writing video files at some point. do not disable ALL of it, only the MFMS part (dshow support works nicely with mingw !)

(2) sorry, forget to mention it. the IPP libs are for VS only, mingw can't use those, so:

berak gravatar imageberak ( 2018-05-19 02:18:32 -0500 )edit

Thank you. I tried with VIDEOIO ON and MFMS OFF it is generating the old error. cmake has downloaded ffmpeg related file and populated in the .cache/ffmpeg directory. Do we need to separately get some files related to ffmpeg ?

gcc: error: Settings\Administrator\Desktop\OCV34\opencv341\3rdparty\include\ffmpeg_: No such file or directory C:\TDM-GCC-64\bin\windres.exe: preprocessing failed. mingw32-make.exe[2]: * [modules/videoio/CMakeFiles/opencv_videoio.dir/vs_version.rc.obj] Error 1 mingw32-make.exe[1]: * [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 modules\videoio\CMakeFiles\opencv_videoio.dir\build.make:187: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/vs_version.rc.obj' failed

pranan gravatar imagepranan ( 2018-05-19 06:52:13 -0500 )edit

apologies again, there's so much i forgot. no you don't any more additional files (you need to have opencv_fmpeg.dll on the PATH to vire video files or ipcams.

but you have to switch off ENABLE_PRECOMPILED_HEADERS to get around the resource compiler problem

berak gravatar imageberak ( 2018-05-19 07:56:46 -0500 )edit

Thanks for the guidance given. PRECOMPILED _HEADERS OFF, MFMS OFF, IPP OFF I could compile Opencv4 master along with contib. Your knowledge has reduced my pain, thanks once again

pranan gravatar imagepranan ( 2018-05-21 05:10:33 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-05-18 04:04:14 -0500

Seen: 42 times

Last updated: May 18