opencv3.2.0 Cmake 3.8.0 编译问题

opencv3.2.0 Cmake 3.8.0 TDM-GCC 5.1.0

Windows 7 遇到如下错误

[ 53%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/videoio/
src/cap_vfw.cpp.obj
[ 53%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/videoio/
src/cap_ffmpeg.cpp.obj
D:\Resource\opencv\sources\modules\videoio\src\cap_ffmpeg.cpp:65:42: warning: ty
pe qualifiers ignored on function return type [-Wignored-qualifiers]
 static const HMODULE cv_GetCurrentModule()
                                          ^
[ 53%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/highgui/
src/window.cpp.obj
[ 53%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/highgui/
src/window_w32.cpp.obj
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp:51:6: warning: "_W
IN32_IE" is not defined [-Wundef]
 #if (_WIN32_IE < 0x0500)
      ^
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp:52:99: note: #prag
ma message: WARNING: Win32 UI needs to be compiled with _WIN32_IE >= 0x0500 (_WI
N32_IE_IE50)
 #pragma message("WARNING: Win32 UI needs to be compiled with _WIN32_IE >= 0x050
0 (_WIN32_IE_IE50)")

                   ^
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp: In function ‘void
 cvSetModeWindow_W32(const char*, double)‘:
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp:474:47: error: ‘MO
NITOR_DEFAULTTONEAREST‘ was not declared in this scope
             hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
                                               ^
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp:474:71: error: ‘Mo
nitorFromRect‘ was not declared in this scope
             hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
                                                                       ^
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp: In function ‘LRES
ULT MainWindowProc(HWND, UINT, WPARAM, LPARAM)‘:
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp:1377:45: error: ‘M
ONITOR_DEFAULTTONEAREST‘ was not declared in this scope
           hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
                                             ^
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp:1377:69: error: ‘M
onitorFromRect‘ was not declared in this scope
           hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
                                                                     ^
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp: In function ‘LRES
ULT HighGUIProc(HWND, UINT, WPARAM, LPARAM)‘:
D:\Resource\opencv\sources\modules\highgui\src\window_w32.cpp:1549:24: warning:
left operand of comma operator has no effect [-Wunused-value]
             } while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warni
ng C4127: "conditional expression is constant"
                        ^
modules\world\CMakeFiles\opencv_world.dir\build.make:4678: recipe for target ‘mo
dules/world/CMakeFiles/opencv_world.dir/__/highgui/src/window_w32.cpp.obj‘ faile
d
mingw32-make[2]: *** [modules/world/CMakeFiles/opencv_world.dir/__/highgui/src/w
indow_w32.cpp.obj] Error 1
CMakeFiles\Makefile2:2324: recipe for target ‘modules/world/CMakeFiles/opencv_wo
rld.dir/all‘ failed
mingw32-make[1]: *** [modules/world/CMakeFiles/opencv_world.dir/all] Error 2
Makefile:161: recipe for target ‘all‘ failed
mingw32-make: *** [all] Error 2

  

在modules/highgui/src/precomp.hpp文件里面删除以下加粗加黑的内容

 #if defined WIN32 || defined WINCE

     #if !defined _WIN32_WINNT
         #ifdef HAVE_MSMF
            #define _WIN32_WINNT 0x0600 // Windows Vista
         #else
             #define _WIN32_WINNT 0x0500 // Windows 2000
         #endif
    #endif

#include <windows.h>

  

然后在modules/highgui/src/window_w32.cpp文件里面添加一下加粗加黑的内容

#if defined WIN32 || defined _WIN32

 #define COMPILE_MULTIMON_STUBS // Required for multi-monitor support
 #ifndef _MULTIMON_USE_SECURE_CRT
 #  define _MULTIMON_USE_SECURE_CRT 0 // some MinGW platforms have no strncpy_s
 #endif

 #if defined SM_CMONITORS && !defined MONITOR_DEFAULTTONEAREST
 #  define MONITOR_DEFAULTTONULL       0x00000000
 #  define MONITOR_DEFAULTTOPRIMARY    0x00000001
 #  define MONITOR_DEFAULTTONEAREST    0x00000002
 #  define MONITORINFOF_PRIMARY        0x00000001
 #endif
 #ifndef __inout
 #  define __inout
 #endif

  #ifdef __GNUC__
  #  pragma GCC diagnostic ignored "-Wmissing-declarations"
  #endif

  #include <commctrl.h>
 #include <winuser.h>
  #include <stdlib.h>
  #include <string.h>

  

引用:http://blog.csdn.net/chentianqiao555/article/details/41154977

时间: 2024-10-14 02:06:33

opencv3.2.0 Cmake 3.8.0 编译问题的相关文章

CentOS6.5、Hadoop-2.2.0、64 位的编译

1.安装CentOS6.5 下载地址是 http://mirror.neu.edu.cn/centos/6.5/isos/x86_64/ 选择 CentOS-6.5-x86_64-bin-DVD1.iso 下载,注意是 64 位的,大小是 4GB,需要下载一段时间的. 其实 6.x 的版本都可以,不一定是 6.5,一定要保持 linux 联网状态. 说明:我把软件下载后全部复制到/usr/local 目录下,以下命令执行的路径是在/usr/local 目录下. 请读者在阅读时,一定要注意路径.

第8章 Android 4.0系统的下载与编译

第8章  Android 4.0系统的下载与编译 本章首先的准备Android下载与编译环境,内容主要分为:准备Android下载与编译环境.下载源码.编译源码及内核源码.下载Android 4.0及Goldfish源码中包括下载并初始化repo工具.下载Android源码.其他源码下载源.下载模拟器Goldfish内核源码.编译Android及Goldfish内核源码中切换到Android源码目录命令:$cd WORKING_DIRECTORY 执行如下命令,加载编译过程中用到的命令.环境变量

Spark-1.0.1 的make-distribution.sh编译、SBT编译、Maven编译 三种编译方法

本文编译方法所支持的hadoop环境是Hadoop-2.2.0,YARN是2.2.0,JAVA版本为1.8.0_11,操作系统Ubuntu14.04 Spark1.0.0 源码下载地址: http://mirror.bit.edu.cn/apache/spark/spark-1.0.0/spark-1.0.0.tgz Spark1.0.1 源码下载地址:http://apache.fayea.com/apache-mirror/spark/spark-1.0.1/spark-1.0.1.tgz

windows下cocos2dx3.0开发环境及Android编译环境搭建

cocos2dx更新到了3.x版本,自己一直没有换,现在开发组要求统一换版本,我就把搭建环境的过程记录下来. 一.Windowns下开发环境搭建 1.  所需工具 1)cocos2d-x-3.0rc0.zip   http://cn.cocos2d-x.org/download/  截止写博文时,最新版本为V3.2. 2)VS2012 http://www.baidu.com/s?wd=VS2012 3)Python  https://www.python.org/download/releas

cocos2d-x 3.0 引用第三方库 及编译成apk时android mk文件写法

cocos2d-x 3.0 中,如果你需要使用CocosStudio.Extensions扩展库 等等,都需要自己手动添加. 添加步骤如下:(比如说现在我要添加libExtensions,libCocosStudio , libGUI) 1.添加附加项目 右击解决方案--->添加现有项目--->添加:项目目录\cocos2d\extensions\proj.win32\libExtensions,然后你会发现左边多了一个libExtensions扩展库 右击解决方案--->添加现有项目-

mac os x 编译spark-2.1.0 for hadoop-2.8.0

mac os x maven编译spark-2.1.0  for hadoop-2.8.0 1.官方文档中要求安装Maven 3.3.9+ 和Java 8 ; 2.执行         export MAVEN_OPTS="-Xmx2g -XX:ReservedCodeCacheSize=512m" 3.cd spark2.1.0源码根目录下 ./build/mvn -Pyarn  -Phadoop-2.8  -Dhadoop.version=2.8.0 -Dscala-2.11   

转: MyEclipse 10.0,9.0,8.0 下添加jadClipse反编译插件

MyEclipse 10.0,9.0,8.0 下添加jadClipse反编译插件 (2012-11-19 15:36:35) 转载▼ 标签: myeclipse jad 反编译 插件 it 分类: Myeclipse jad是一个使用比较广泛的Java反编译软件,jadClipse是jad在eclipse下的插件,下面像大家介绍下如何将jadclipse加入到MyEclipse10.X,9.X,8.X当中: 1.http://nchc.dl.sourceforge.net/project/jad

spark cdh5编译安装[spark-1.0.2 hadoop2.3.0 cdh5.1.0]

前提你得安装有Hadoop 我的版本hadoop2.3-cdh5.1.0 1.下载maven包 2.配置M2_HOME环境变量,配置maven 的bin目录到path路径 3.export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m" 4.到官方下载spark-1.0.2.gz压缩包.解压 5.进入spark解压包目录 6.执行./make-distribution.sh --hadoop

opencv3.2+opencv_contrib+cmake

转自原文 opencv3.2+opencv_contrib+cmake 心得体会 初学OpenCV发现opencv3.2(下载链接在附录)是没有xfeatures2d等模块的.第三方库opencv_contrib是在GitHub上.(下载链接在附录).那么问题就在于怎么把原opencv与opencv_contrib合成一个工程,这不仅仅对于加载头文件等有帮助,而且对欣赏源码也很有帮助.通过cmake(下载链接在附录)编译合成一个工程无疑是最好的解决方法. 1.准备工具 1.分别下载opencv3