在windows上进行mingw32 make时发生opencv安装错误
在windows 10平台上使用mingw32 make命令安装opencv,可能会出现以下错误 Windows版本:10 OpenCv:3.2.0 请建议我安装在windows上进行mingw32 make时发生opencv安装错误,opencv,mingw,mingw-w64,Opencv,Mingw,Mingw W64,在windows 10平台上使用mingw32 make命令安装opencv,可能会出现以下错误 Windows版本:10 OpenCv:3.2.0 请建议我安装 D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In constructor 'testing::internal::Mutex::Mutex()': D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In constructor 'testing::internal::Mutex::Mutex()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8829:45: error: cannot convert 'CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to '_RTL_CRITICAL_SECTION*' in initialization
critical_section_(new CRITICAL_SECTION) {
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8830:48: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
::InitializeCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In destructor 'testing::internal::Mutex::~Mutex()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8840:46: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'PCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void DeleteCriticalSection(PCRITICAL_SECTION)'
::DeleteCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::Lock()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8848:43: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void EnterCriticalSection(LPCRITICAL_SECTION)'
::EnterCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::Unlock()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8858:43: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void LeaveCriticalSection(LPCRITICAL_SECTION)'
::LeaveCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::ThreadSafeLazyInit()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8879:27: error: cannot convert 'CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to '_RTL_CRITICAL_SECTION*' in assignment
critical_section_ = new CRITICAL_SECTION;
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8880:54: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
::InitializeCriticalSection(critical_section_);
^
modules\ts\CMakeFiles\opencv_ts.dir\build.make:237: recipe for target 'modules/ts/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
CMakeFiles\Makefile2:5379: recipe for target 'modules/ts/CMakeFiles/opencv_ts.dir/all' failed
mingw32-make[1]: *** [modules/ts/CMakeFiles/opencv_ts.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
当我试图在Windows10上使用mingw32构建opencv3.2.0时,也遇到了同样的问题。我搜索了一下,寻找类似的问题。它说问题在于: MinGW将_CRITICAL_SECTION和_RTL_CRITICAL_SECTION定义为两个独立(等效)的结构,而不是使用typedef 因此,您必须为_CRITICAL_部分和_RTL_CRITICAL_部分添加另一个typedef GTEST_CRITICAL_部分,并将此typedef用于这两种情况 以下是操作方法: 编辑“opencv\sources\modules\ts\include\opencv2\ts\”中的“ts_gtest.h”
这两个更改应该可以修复上述错误。在Windows10上使用mingw32构建OpenCV 3.2.0时,我也遇到了同样的问题。我搜索了一下,寻找类似的问题。它说问题在于: MinGW将_CRITICAL_SECTION和_RTL_CRITICAL_SECTION定义为两个独立(等效)的结构,而不是使用typedef 因此,您必须为_CRITICAL_部分和_RTL_CRITICAL_部分添加另一个typedef GTEST_CRITICAL_部分,并将此typedef用于这两种情况 以下是操作方法: 编辑“opencv\sources\modules\ts\include\opencv2\ts\”中的“ts_gtest.h”
这两个更改应该可以修复上述错误。它是使用TDM gcc mingw编译器修复的。它是使用TDM gcc mingw编译器修复的。访问仍然会遇到相同的错误您的mingw版本是什么?谷歌搜索
无法将“CRITICAL\u SECTION*{aka\u CRITICAL\u SECTION*}”转换为“\u RTL\u CRITICAL\u SECTION*”
显示您可能需要更新MinGW和CMake。()我已经从这个站点下载了minGw,版本是minGw-get-0.6.2,Cmake是3.7.2-win64-x64。你能帮我看看你的MinGW版本吗?谷歌搜索无法将“CRITICAL\u SECTION*{aka\u CRITICAL\u SECTION*}”转换为“\u RTL\u CRITICAL\u SECTION*”
显示您可能需要更新MinGW和CMake。()我已经从这个站点下载了minGw,版本是minGw-get-0.6.2,Cmake是3.7.2-win64-x64。你能帮忙吗
// assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
// This assumption is verified by
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
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_;