码迷,mamicode.com
首页 > 其他好文 > 详细

opencv3.2.0 Cmake 3.8.0 编译问题

时间:2017-04-13 19:10:02      阅读:2889      评论:0      收藏:0      [点我收藏+]

标签:operator   lib   erro   log   crt   fail   for   use   fine   

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

opencv3.2.0 Cmake 3.8.0 编译问题

标签:operator   lib   erro   log   crt   fail   for   use   fine   

原文地址:http://www.cnblogs.com/fundou/p/6705493.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!