Error when install OpenCV on Windows

asked 2019-01-28 02:18:18 -0600

Quang Huy Chu gravatar image

Hi everyone, I have downloaded and install MinGW32, CMake, OpenCV, but when I run mingw32-make i got this error:

C:\C++ Work\opencv-mingw>mingw32-make [ 2%] Built target zlib [ 2%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jmemmgr.c.obj C:\C++ Work\opencv\sources\3rdparty\libjpeg-turbo\src\jmemmgr.c: In function 'realize_virt_arrays': C:\C++ Work\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:\C++ Work\opencv\sources\3rdparty\libjpeg-turbo\src\jmemmgr.c:662:11: note: 'SIZE_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'? C:\C++ Work\opencv\sources\3rdparty\libjpeg-turbo\src\jmemmgr.c:39:1: +#include <stdint.h> C:\C++ Work\opencv\sources\3rdparty\libjpeg-turbo\src\jmemmgr.c:662:11: if (SIZE_MAX - maximum_space < new_space) ^~~~~~~~ C:\C++ Work\opencv\sources\3rdparty\libjpeg-turbo\src\jmemmgr.c:662:11: note: each undeclared identifier is reported only once for each function it appears in3rdparty\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

My MinGW version:

C:\C++ Work>gcc --version gcc (MinGW.org GCC-8.2.0-3) 8.2.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

edit retag flag offensive close merge delete

Comments

maybe mingw 8.2.0 is too advanced. it all works fine with 7.2.0 for me, giiven the cmake options:

WITH_MSMF=OFF
ENABLE_PRECOMPILED_HEADERS=OFF
CPU_DISPATCH=""

as a last resort, you ofc. could also try to disable jpg codec:

BUILD_JPEG=OFF
WiTH_JPEG=OFF
berak gravatar imageberak ( 2019-01-28 05:20:40 -0600 )edit