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 ...
随机推荐
- 第一次接触mysql
一:数据库的好处 1. 可以持久化保存数据在本地 2.结构化查询 二:数据库常见的概念 1.DB: 是datebase数据库的缩写,储存数据得到容器 2.DBMS:数据库管理系统,用于管理数据库,和创 ...
- getElementsByName和getElementById
1: 今天分享工作中遇到的一个小细节 1.1 先介绍一下两个方法分别是: 1.2 getElementById() :可返回对拥有指定 ID 的第一个对象的引用,如果您需要查找文档中的一个特定的元素 ...
- RPAD()和LPAD()函数进行字符串的填充
RPAD()函数从右边对字符串使用指定的字符进行填充. 格式:RPAD(string,padded_length,[pad_string]) string 表示:被填充的字符串. padded_len ...
- ios 判断用户是否开启权限---并跳转设置
ios 判断用户是否开启权限---并跳转设置 ios 判断用户是否开启权限---并跳转“系统设置” 1.判断 访问相册 或 相机 权限是否开启 2.检测是否开启定位 后面将持续更新 只有在应用请求过位 ...
- c# Hash一致算法负载均衡(KetamaHash)项目升级
其实就是我最近写的一个项目,采用Hash一致满足负载均衡.Hash一致环带虚拟节点. 在前面的博文中说明了我采用的方法,MurmurHash+红黑树(底层其实是sortedlist).经过多次测试结合 ...
- windows 开启 nginx 监听80 端口 以及 禁用 http 服务后,无法重启 HTTP 服务,提示 系统错误 123,文件目录、卷标出错
1. 正常情况直接运行 start nginx.exe 不能开启成功,因为 80 端口被占用.提示: bind() to 0.0.0.0:80 failed (10013: An attempt w ...
- vs2017中的scanf_s
在visual studio 2017中格式化输入函数不同于其他c/c++编译器使用scanf,而是使用scanf_s. scanf_s相比较于scanf来说更安全,因为使用scanf_s函数需要有一 ...
- Flask-SQLAlchemy安装及设置
Flask-SQLAlchemy安装及设置 SQLALchemy 实际上是对数据库的抽象,让开发者不用直接和 SQL 语句打交道,而是通过 Python 对象来操作数据库,在舍弃一些性能开销的同时,换 ...
- XAMPP中的MySQL与本地MySQL冲突的问题
学习SQL时在本地中先安装了MySQL,后来因为项目需要又安装了XAMPP集成环境,今天在启动项目的时候发现启动MySQL各种问题(期望启动的是XAMPP中的MySQL服务),在Navicat中显示成 ...
- 谈谈toLocaleString()
如何理解toLocaleString()? toLocaleString()就是把数组转换为本地字符串.首先调用每个数组元素的toLocaleString()方法,然后使用地区特定的分隔符把生成的字符 ...