MingW Cmake bulid OpenCV

来源:互联网 发布:机智自动交易软件 编辑:程序博客网 时间:2024/05/16 16:58

MingW需要安装,可以随codeblocks安装,但是需要注意安装位置。
cmake需要知道mingw的安装位置,而cmake是通过系统变量知道的,系统变量是操作系统管理的,所以首先绿色版的mingw肯定是不行的,除非手动增加系统变量,win8情况下mingw随codeblocks安装在program files下没有问题,但是win10经测不行,报如下错误

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.

参考此贴

最后把我整个解决方法说下:首先看看Mingw的官方文档的说明:we strongly recommend that you do not install MinGW in any location with spaces in the path name reference. You should avoid installing into any directory or subdirectory having names like “Program Files” or “My Documents”, etc.
The preferred installation target directory is C:\MinGW
我的mingw的安装目录开始是在d:\Program Files下,上面官方文档说的很清楚,要避免安装在这样的目录下(已用红色标出),我将mingw装在C:\MinGW下后就可以用camke编译了,当然中途也出现过一些错误,那都是与版本有关,最后我参照CSDN的一个帖子用的opencv2.4.9 cmake2.8.12成功编译

以上办法仍然无效,需要手动添加mingw的bin文件夹路径到系统环境变量path

0 0
原创粉丝点击