学习OpenCV3:CMake+MinGW编译OpenCV错误(Error in configuration process, project files may be invalid)


1. 错误描述

  在使用CMake编译OpenCV时,选择MinGW Makefiles,CMake出现如下错误:

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!
CMake错误

2. 解决方法

  此类错误是因为MinGW安装目录缺少mingw32-make.exe导致的。
  例如我出现这个错误是因为我安装MinGW后把默认的mingw32-make.exe改成了make.exe。故现在只需将make.exe恢复成原名mingw32-make.exe即可。

错误原因
mingw32-make.exe
CMake开始正常编译

  对于缺少mingw32-make.exe,可以前往https://sourceforge.net/projects/mingw-w64/files/
下载安装MinGW。若是使用CMake+MinGW编译OpenCV,对于64位电脑,个人推荐x86_64-posix-sjlj,编译错误会少一点。

MinGW版本

你可能感兴趣的:(学习OpenCV3:CMake+MinGW编译OpenCV错误(Error in configuration process, project files may be invalid))