okay i was trying setup an environment for human detection program.. programming language i will use is c++ and compiler is code blocks.. i have downloaded opencv 4.1 also downloaded CMake and mingw i have also added path in environment setting.. i extracted opencv in c:\\opencv\\sources folder and by using cmake i have configured and generated build files in c:\\opencv\\build
after this i open C:\\opencv\\source\\opencv\\build this folder and right click on it and open powershell and typed mingw32-make commnd.
so that Mingw will start compiling OpenCV but after 5% error popout there...
PS C:\opencv\source\opencv\build> mingw32-make
[ 2%] Built target zlib [ 2%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jmemmgr.c.obj C:\\opencv\\source\\opencv\\sources\\3rdparty\\libjpeg-turbo\\src\\jmemmgr.c: In function 'realize_virt_arrays': C:\\opencv\\source\\opencv\\sources\\3rdparty\\libjpeg-turbo\\src\\jmemmgr.c:662:11: error: 'SIZE_MAX' undeclared (first use in this function) if (SIZE_MAX - maximum_space < new_space) ^~~~~~~~ C:\\opencv\\source\\opencv\\sources\\3rdparty\\libjpeg-turbo\\src\\jmemmgr.c:662:11: note: each undeclared identifier is reported only once for each function it appears in 3rdparty\\libjpeg-turbo\\CMakeFiles\\libjpeg-turbo.dir\\build.make:678: recipe for target '3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jmemmgr.c.obj' failed mingw32-make[2]: * [3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jmemmgr.c.obj] Error 1 CMakeFiles\\Makefile2:312: recipe for target '3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/all' failed mingw32-make[1]: * [3rdparty/libjpeg-turbo/CMakeFiles/ libjpeg-turbo.dir/all] Error 2 Makefile:161: recipe for target 'all' failed mingw32-make: *** [all] Error 2
Actually it is possible to compile opencv 3.4.3 by mingw32 (i have used 5.3.0 for the instance). Follow this guide. It is little bit old but works even for opencv 3.4.3 Steps to build:
All options are red is normal, check "Grouped" in right top region of the CMake window, now we should check some flags:
in group CMAKE: for option CMAKE_BUILD_TYPE write Release (to build release version of opencv), also here you can specify where you want Opencv binaries will be installed after build
in group ENABLE: check ENABLE_CXX11 and uncheck ENABLE_PRECOMPILED_HEADERS
in group WITH: uncheck WITH_MSMF
Press "Configure" button, whait untill processing will be complited, now all options should become white
Press "Generate" button and wait (in your build directory Makefile should be created, you can close CMake after this step)
Make shure your mingw toolchain location is known for your system (look if system environment variable PATH contains path to mingw toolchain)
Open cmd.exe, change directory to your opencv's build idrectory
Let's build opencv (-j[uint] - option specifies number of threads to use)
.../build> mingw32-make -j4
Let's install opencv
.../build> mingw32-make install
Done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.