Ask Your Question

Building OpenCV 3.4.1 from source [MinGW32, cmake 3.6.2, Qt 5.10, Windows 10]

asked 2018-03-08 11:46:24 -0500


I am trying to build OpenCV 3.4.1 from source using CMake (GUI) and MinGW. I didn't find another way to use the OpenCV library in Windows. I use Qt as programming environment and want to extend a C++ project which includes OpenCV 3.

I followed this tutorial to compile the sources. Unfortunately, I get some errors in the building step using the "mingw32-make" command.

Scanning dependencies of target opencv_videoio
[ 44%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_dshow.cpp.obj
[ 44%] Building RC object modules/videoio/CMakeFiles/opencv_videoio.dir/vs_version.rc.obj
gcc: error: 3.4.1\sources\3rdparty\include\ffmpeg_: No such file or directory
C:\MinGW\bin\windres.exe: preprocessing failed.
modules\videoio\CMakeFiles\opencv_videoio.dir\build.make:261: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/vs_version.rc.obj' failed
mingw32-make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/vs_version.rc.obj] Error 1
CMakeFiles\Makefile2:5113: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
mingw32-make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

I already tried to disable the WITH_FFMPEG flag, since I do not need FFMPEG for my project, but the errors remain.

Do you have an idea how to overcome this errors?

Thank you for your help!

edit retag flag offensive close merge delete


Try to disable videoio module: -DBUILD_opencv_videoio=OFF and do a clean build.

Also I'd recommend using mingw-w64, because mingw32 have not been updated for a long time.

Final advice: check your paths, they should not contain spaces, slashes, dots, pluses, colons, semicolons and other symbols. Try to use paths with letters a-z and digits 0-9 and underscore.

mshabunin gravatar imagemshabunin ( 2018-03-08 13:04:57 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-03-09 04:41:33 -0500

-DBUILD_opencv_videoio=OFF worked for me. Thank you for your help!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-03-08 11:46:24 -0500

Seen: 929 times

Last updated: Mar 08 '18