opencv3.2.0 Cmake 3.8.0 + tdm-gcc-5.1.0-3 OpenThread

opencv3.2.0 Cmake 3.8.0 TDM-GCC 5.1.0
Windows 7 遇到如下错误

D:Resourceopencvsourcesmodules	ssrc	s_gtest.cpp: In static member functio
n 'static void testing::internal::ThreadLocalRegistryImpl::StartWatcherThreadFor
(DWORD)':
D:Resourceopencvsourcesmodules	ssrc	s_gtest.cpp:9082:21: error: '::OpenTh
read' has not been declared
     HANDLE thread = ::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION,
                     ^
modules	sCMakeFilesopencv_ts.diruild.make:237: recipe for target 'modules/t
s/CMakeFiles/opencv_ts.dir/src/ts_gtest.cpp.obj' failed
mingw32-make[2]: *** [modules/ts/CMakeFiles/opencv_ts.dir/src/ts_gtest.cpp.obj]
Error 1
CMakeFilesMakefile2:2455: recipe for target 'modules/ts/CMakeFiles/opencv_ts.di
r/all' failed
mingw32-make[1]: *** [modules/ts/CMakeFiles/opencv_ts.dir/all] Error 2
Makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

  

TDM-GCC-32includecommctrl.h

#ifndef _WIN32_IE
/* define _WIN32_IE if you really want it */
#if 1
#define _WIN32_IE	0x0800
#endif
#endif

没卵用

引用 http://mingw.5.n7.nabble.com/Missing-OpenThread-td13250.html

#if GTEST_HAS_RTTI
# include <typeinfo>
#endif

// Determines whether Google Test can use the pthreads library.

#define GTEST_HAS_PTHREAD 0

#ifndef GTEST_HAS_PTHREAD
// The user didn't tell us explicitly, so we make reasonable assumptions about
// which platforms have pthreads support.
//
// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
// to your compiler flags.
# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX 
    || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL)
#endif  // GTEST_HAS_PTHREAD

  

http://blog.sina.com.cn/s/blog_654c6ec70101ly9s.html

解决方案未测试

http://stackoverflow.com/questions/41918477/how-to-build-opencv-3-2-0-with-mingw-on-windows?noredirect=1

解决办法

换用 tdm64-gcc-5.1.0-2 且使用未更改的Opencv 3.2.0 源代码进行编译,本部分验证可通过

原文地址:https://www.cnblogs.com/fundou/p/6707124.html