opencv4.4之minw64编译安装报错时的解决方案

常用配置:

WITH_OPENGL=ON
DBUILD_opencv_rgbd=OFF #此项需要关闭,不然编译opencv_contrib时会报错
OPENCV_GENERATE_SETUPVARS=OFF
OPENCV_EXTRA_MODULES_PATH=your path #这里填写opencv_contrib/modules的路径

编译时报错:

[ 43%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
gcc: error: long: No such file or directory
C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\windres.exe: preprocessing failed.
mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1265: modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
mingw32-make[2]: *** Waiting for unfinished jobs....
mingw32-make[1]: *** [CMakeFiles\Makefile2:3666: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2

需要额外添加两条配置
DOPENCV_SKIP_LIBATOMIC_COMPILER_CHECK=ON
DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int64_t
OPENCV_ENABLE_ALLOCATOR_STATS=OFF

DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE
DOPENCV_SKIP_LIBATOMIC_COMPILER_CHECK

你可能感兴趣的:(opencv4.4之minw64编译安装报错时的解决方案)