mingw编译opencv2.4.13问题记录
为了在程序中用regex,升级了我的mingw,结果官网上的GCC版本都到6.3了,之前一直用4.8。换了编译器以后,对opencv2.4.10的引用就出了问题:undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)',所以尝试使用新的编译器编译opencv,顺便也把opencv升级到2.4.13。
使用mingw64的32位版本编译opencv,默认配置。gcc version 6.3.0
编译过程中出错,报:
error: unrecognized command line option '-sse2'; did you mean '-msse2'?
搜索无果,在makefile中找到这一行,放在命令行中执行,发现缺少一个头文件的包含路径,加上以后重新在命令行执行,编译成功,继续make
g++ -O2 -DNDEBUG -DNDEBUG -I"D:/software/opencv/opencv-2.4.13/modules/gpu/perf" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/ts/include" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv-2.4.13/modules/photo/include" -I"D:/software/opencv/opencv-2.4.13/modules/objdetect/include" -I"D:/software/opencv/opencv-2.4.13/modules/legacy/include" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/ml/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -isystem"D:/software/opencv/opencv2.4.13mingw/modules/gpu" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/src" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/test" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/ts/include" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv-2.4.13/modules/photo/include" -I"D:/software/opencv/opencv-2.4.13/modules/objdetect/include" -I"D:/software/opencv/opencv-2.4.13/modules/legacy/include" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/ml/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -isystem"D:/software/opencv/opencv2.4.13mingw/modules/gpu" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/src" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/src/cuda" -I"D:/software/opencv/opencv-2.4.13/modules/photo/include" -I"D:/software/opencv/opencv-2.4.13/modules/objdetect/include" -I"D:/software/opencv/opencv-2.4.13/modules/legacy/include" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/ml/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -isystem"D:/software/opencv/opencv2.4.13mingw/modules/gpu" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/src" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -isystem"D:/software/opencv/opencv2.4.13mingw" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/perf" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/ts/include" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv-2.4.13/modules/photo/include" -I"D:/software/opencv/opencv-2.4.13/modules/objdetect/include" -I"D:/software/opencv/opencv-2.4.13/modules/legacy/include" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/ml/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -isystem"D:/software/opencv/opencv2.4.13mingw/modules/gpu" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/src" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/test" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/ts/include" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv-2.4.13/modules/photo/include" -I"D:/software/opencv/opencv-2.4.13/modules/objdetect/include" -I"D:/software/opencv/opencv-2.4.13/modules/legacy/include" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/ml/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -isystem"D:/software/opencv/opencv2.4.13mingw/modules/gpu" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/src" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/src/cuda" -I"D:/software/opencv/opencv-2.4.13/modules/photo/include" -I"D:/software/opencv/opencv-2.4.13/modules/objdetect/include" -I"D:/software/opencv/opencv-2.4.13/modules/legacy/include" -I"D:/software/opencv/opencv-2.4.13/modules/video/include" -I"D:/software/opencv/opencv-2.4.13/modules/ml/include" -I"D:/software/opencv/opencv-2.4.13/modules/calib3d/include" -I"D:/software/opencv/opencv-2.4.13/modules/features2d/include" -I"D:/software/opencv/opencv-2.4.13/modules/highgui/include" -I"D:/software/opencv/opencv-2.4.13/modules/imgproc/include" -I"D:/software/opencv/opencv-2.4.13/modules/flann/include" -I"D:/software/opencv/opencv-2.4.13/modules/core/include" -isystem"D:/software/opencv/opencv2.4.13mingw/modules/gpu" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/src" -I"D:/software/opencv/opencv-2.4.13/modules/gpu/include" -I"D:/software/opencv/opencv2.4.13mingw" -isystem"D:/software/opencv/opencv2.4.13mingw" -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -x c++-header -o D:/software/opencv/opencv2.4.13mingw/modules/gpu/perf_precomp.hpp.gch/opencv_perf_gpu_Release.gch D:/software/opencv/opencv2.4.13mingw/modules/gpu/perf_precomp.hpp
然后出了错误:
error: '::hypot' has not been
查了此链接:
http://blog.csdn.net/a3335581/article/details/68583030
和http://stackoverflow.com/questions/28683358/error-hypot-has-not-been-declared-in-cmath-while-trying-to-embed-python
都说要在include Python前include cmath,所以在:
\opencv-2.4.13\modules\python\src2\cv2.cpp 文件中加了一句:
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
// eliminating duplicated round() declaration
#define HAVE_ROUND 1
#endif
#include <cmath>
#include <Python.h>
但是不管用,通过查看错误提示:
In file included from C:/Python27/include/Python.h:8:0,
from D:\software\opencv\opencv-2.4.13\modules\python\src2\cv2.cpp:6:
C:/msys32/mingw32/include/c++/6.3.0/math.h:91:12: error: 'std::_hypot' has not been declared
using std::hypot;
^
认为应该加include math.h
所以将cmath改成:
#include <math.h>
以后,错误消除。
然后发生了错误:
libpython27.a: error adding symbols: File format not recognized
搜索说是要将libpython27.a移出C:\Python27\libs文件夹,然后将python27.dll文件放入此文件夹,然后下载gendef.exe
gendef python27.dll
dlltool --as-flags=--32 --dllname python27.dll --def python27.def --output-lib libpython27.a -m i386
创建一个正确的libpython27.a ,每一个object 都是32-bit.
然后就编译成功了。
用新的opencv做程序,结果之前存在的问题还是存在,于是白弄了
mingw编译opencv2.4.13问题记录的更多相关文章
- Ubuntu16.04下编译OpenCV2.4.13静态库(.a文件)
Ubuntu16.04下编译OpenCV2.4.13静态库(.a文件) https://blog.csdn.net/woainishifu/article/details/79712110 我们在做项 ...
- ubuntu 16.04下安装使用OpenCV2.4.13
本来项目是在Windows下写的,结果对接的时候发现要在Linux下实现,没办法只能重新移植了.以前在ubuntu上使用过OpenCV,可惜系统已经重新安装过,只能重新来一遍了,索性就记录一下安装过程 ...
- ubuntu16.04安装opencv2.4.13
1.更新 sudo apt-get update sudo apt-get upgrade 2.安装关联库 2.1 搭建C/C++编译环境 sudo apt-get install build-ess ...
- OpenCV2.4.13+VS2013开发环境配置
List1:完成 写在前面:之前电脑很杂乱的装了OpenCV的2个版本,在配置OpenCV和VS2013环境时死活配不好.但是接下来的工作要用到,没有办法,还是得好好做.今天重新装了OpenCV2.4 ...
- ubuntu 14.04 opencv2.4.13 安装
1.下载然后解压安装压缩包 unzip opencv-2.4.13.zip 2. 进入刚解压的文件夹,建立release文件夹 cd opencv-2.4.13 mkdir release 3. 安装 ...
- Ubuntu16.04下安装OpenCV2.4.13
软件版本 Ubuntu 16.04; OpenCV 2.4.13 安装步骤 1.首先安装一些编译工具 # 安装编译工具 sudo apt-get install build-essential # 安 ...
- windows7 64位机上配置支持GPU版(CUDA7.5)的OpenCV2.4.13操作步骤
很久之前在windows7 32位上配置过GPU版的opencv,可参考http://blog.csdn.net/fengbingchun/article/details/9831837 Window ...
- OpenCV2.4.13+VS2012开发环境配置
1.下载和安装OpenCV SDK 在OpenCV官网的下载页面: http://opencv.org/downloads.html 找到对应OpenCV for Windows版本下载.目前(2 ...
- 2、opencv2.4.13.6安装
一. 卸载opencv3.3.0: Going to the "build" folder directory of opencv from terminal, and execu ...
随机推荐
- MVC5 Attribute(特性)
AuthorizeAttribute:一般用来判断权限 ActionFilterAttribute:方法执行前后动作 OutputCacheAttribute:输出缓存设置 注:我们创建名称的时候请带 ...
- 史上最简单的 SpringCloud 教程 | 第一篇: 服务的注册与发现Eureka(Finchley版本)
转载请标明出处: 原文首发于:https://www.fangzhipeng.com/springcloud/2018/08/30/sc-f1-eureka/ 本文出自方志朋的博客 一.spring ...
- 卸载MySQL以及重装卡到Start Services的解决办法(亲测有效,刚重装成功)
卸载MySQL以及重装卡到Start Services的解决办法 重装系统永远是个好办法,但是对于我们程序员来说只要一想到电脑上的环境变量和其他的配置就蔫了.所以这一条就当作是废话吧. 一般来说装My ...
- 关于math.random()的问题
今天在写一个关于随机数的小程序时,在程序执行时,发现随机数不能执行随机,随机结果始终为1. 下面贴上一开始错误的代码 int i = (int)Math.random()*3+1; 无论运行多少次,结 ...
- 快速排序_C语言_数组
快速排序_C语言_数组 #include <stdio.h> void quickSort(int *, int, int); int searchPos(int *, int, int) ...
- MySQL 避免行锁升级为表锁——使用高效的索引
文章目录 普通索引 属性值重复率高 属性值重复率低 小结 众所周知,MySQL 的 InnoDB 存储引擎支持事务,支持行级锁(innodb的行锁是通过给索引项加锁实现的).得益于这些特性,数据库支持 ...
- WebGL学习笔记(2)
根据上一篇学习笔记,理解WebGL的工作原理及基本调用代码后,可以开始研究3D顶点对象的缩放.旋转.以及对对象进行可交互(鼠标或键盘控制)的旋转或者缩放. 要理解对象的旋转/缩放需要首先学习矩阵的计算 ...
- Javascript的加载
最新博客站点:欢迎来访 1. 浏览器加载 (1) 同步加载 在网页中,浏览器加载js文件的方式是通过<script>标签.如下所示: //内嵌脚本 <script type= ...
- 吐血分享:QQ群霸屏技术教程2017(效益篇)
懂得如何做群排名了,接下来就要实质性的考虑产出了. 可能,咱们经常发现,一些群里拉人的,进群看某片,5元钱终生,这类是灰色的.其实正规的付费空间也很大. 群利润空间 有工作,有产品,有项目,可以做群排 ...
- video.js使用技巧
https://www.awaimai.com/2053.html https://www.jianshu.com/p/16fa00a1ca8e