MingW编译OpenCV3.2的recipe for target 'modules/ts/CMakeFiles/opencv_ts.dir/all' failed解决

在opencv\sources\modules\ts\include\opencv2\ts\的文件夹下找到ts_gtest.h文件下:

struct _RTL_CRITICAL_SECTION;
修改为

#if GTEST_OS_WINDOWS_MINGW
// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
// separate (equivalent) structs, instead of using typedef
typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#else
// Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
// This assumption is verified by
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION
typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#endif

同时

RTL_CRITICAL_SECTION* critical_section;

修改为

GTEST_CRITICAL_SECTION* critical_section_;

你可能感兴趣的:(MingW编译OpenCV3.2的recipe for target 'modules/ts/CMakeFiles/opencv_ts.dir/all' failed解决)