为了在程序中用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问题记录的更多相关文章

  1. Ubuntu16.04下编译OpenCV2.4.13静态库(.a文件)

    Ubuntu16.04下编译OpenCV2.4.13静态库(.a文件) https://blog.csdn.net/woainishifu/article/details/79712110 我们在做项 ...

  2. ubuntu 16.04下安装使用OpenCV2.4.13

    本来项目是在Windows下写的,结果对接的时候发现要在Linux下实现,没办法只能重新移植了.以前在ubuntu上使用过OpenCV,可惜系统已经重新安装过,只能重新来一遍了,索性就记录一下安装过程 ...

  3. 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 ...

  4. OpenCV2.4.13+VS2013开发环境配置

    List1:完成 写在前面:之前电脑很杂乱的装了OpenCV的2个版本,在配置OpenCV和VS2013环境时死活配不好.但是接下来的工作要用到,没有办法,还是得好好做.今天重新装了OpenCV2.4 ...

  5. ubuntu 14.04 opencv2.4.13 安装

    1.下载然后解压安装压缩包 unzip opencv-2.4.13.zip 2. 进入刚解压的文件夹,建立release文件夹 cd opencv-2.4.13 mkdir release 3. 安装 ...

  6. Ubuntu16.04下安装OpenCV2.4.13

    软件版本 Ubuntu 16.04; OpenCV 2.4.13 安装步骤 1.首先安装一些编译工具 # 安装编译工具 sudo apt-get install build-essential # 安 ...

  7. windows7 64位机上配置支持GPU版(CUDA7.5)的OpenCV2.4.13操作步骤

    很久之前在windows7 32位上配置过GPU版的opencv,可参考http://blog.csdn.net/fengbingchun/article/details/9831837 Window ...

  8. OpenCV2.4.13+VS2012开发环境配置

    1.下载和安装OpenCV SDK 在OpenCV官网的下载页面: http://opencv.org/downloads.html   找到对应OpenCV for Windows版本下载.目前(2 ...

  9. 2、opencv2.4.13.6安装

    一. 卸载opencv3.3.0: Going to the "build" folder directory of opencv from terminal, and execu ...

随机推荐

  1. 分享一个带有合计行功能的DataGridView扩展

    因为一个Winform的项目中需要用到带有合计行的表格,并且需要满足以下需求: 合计行可自动对需要求和的列进行求和计算; 合计行必须固定(冻结)在表格的最底部,且其位置不受滚动条的滚动而移动; 可以设 ...

  2. JavaFXML实现新窗口打开

    实现原理顺着往下看就明白了,流程看红色字体.具体还有什么问题可以留言. 主页面配置文件,一共三个按钮.这里说明第一个按钮触发打开新窗口 <?xml version="1.0" ...

  3. %ROWTYPE在INSERT和UPDATE语句里的妙用

    PL/SQL里的ROWTYPE类型具有非常大的用处和灵活性,现在发现ROWTYPE在insert和update语句里的妙用,可以节省很多代码,特别是在行copy和更新的时候. 在INSERT语句中: ...

  4. CodePush自定义更新弹框及下载进度条

    CodePush 热更新之自定义更新弹框及下载进度 先来几张弹框效果图 非强制更新场景 image 强制更新场景 image 更新包下载进度效果 image 核心代码 这里的热更新Modal框,是封装 ...

  5. Git工作流指南:Gitflow工作流

    git工作流 1.Git flow 核心分支:master,dev 可能还会有:功能分支,bug修复分支,预发布分支 2.github flow:只一个长期分支,就是master 第一步:根据需求,从 ...

  6. 前端之Vue.js库的使用

    vue.js简介 Vue.js读音 /vjuː/, 类似于 view Vue.js是前端三大新框架:Angular.js.React.js.Vue.js之一,Vue.js目前的使用和关注程度在三大框架 ...

  7. bean工具类

    package com.zq.utils; import java.lang.reflect.Method;import java.util.Arrays;import java.util.Colle ...

  8. web前端总结面试问题(理论)

    一个页面从输入url到页面显示加载完成,这个过程发生了什么? 1.浏览器根据请求的URL交给DNS域名解析,找到真实的IP,向服务器发起请求. 2.服务器交给后台处理完成后返回数据,浏览器接收文件(h ...

  9. ElasticSearch 安装配置

    1.   Elasticsearch5.5.2安装 1.1.Elasticsearch安装步骤 #安装之前需安装java 环境,并配置JAVA_HOME环境变量 #直接下载Elasticsearch- ...

  10. Learning Experience of Big Data:The First Day-Try to set up a network connection on my virtural machine

    After we install our virtual machine,the first thing we should do is to set up a network connection ...