2017-01-30 2 views
4

opencv Installation mit Mingw32-make-Befehl in Windows 10 Plattform, dann wahrscheinlich am Ende der unteren Fehler zu bekommen.opencv Installationsfehler, während Mingw32-make auf Windows

Windows-Version: 10 OpenCV: 3.2.0

Bitte machen Sie mir bei der Installation.

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 
+0

Besuchen Sie [diese Seite] (http://stackoverflow.com/questions/41918477/how-to-build-opencv-3-2-0-with-mingw-on-windows?noredirect=1#comment71040237_41918477) –

+0

Immer noch den gleichen Fehler –

+0

Was ist Ihre MinGW-Version? Googlen 'kann 'CRITICAL_SECTION * {aka _CRITICAL_SECTION *}' nicht in '_RTL_CRITICAL_SECTION *' konvertieren 'hat gezeigt, dass du MinGW und CMake aktualisieren musst. ([Beispiel] (https://github.com/google/googletest/issues/484)) – Alex

Antwort

7

ich sah sich auch das gleiche Problem bei dem Versuch, OpenCV 3.2.0 mit mingw32 auf Microsoft Windows 10 zu bauen. Ich suchte ein wenig, um a fix on Github für ähnliches Problem zu finden. Es wird gesagt, das Problem war:

MinGW definiert _CRITICAL_SECTION und _RTL_CRITICAL_SECTION als zwei getrennte (Äquivalent) structs, anstelle der Verwendung von typedef

Also müssen Sie eine andere typedef GTEST_CRITICAL_SECTION für _CRITICAL_SECTION und _RTL_CRITICAL_SECTION und Verwendung hinzufügen dieser Typ ist für jeden Fall geeignet.

Hier ist was zu tun ist:

bearbeiten "ts_gtest.h", die im Inneren ist "opencv \ sources \ modules \ ts \ include \ opencv2 \ ts \"

    Ersetzen Sie diese Zeile (vermutlich Linie 723)

 


    // 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; 

 

mit

 


    #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 

 
  1. diese Zeile ersetzen (wahrscheinlich auf der Linie 3060 vor der Bearbeitung - Zeilennummer geändert haben würde, wie Sie ersten Teil geändert)
 


    _RTL_CRITICAL_SECTION* critical_section_; 

 

mit

 


    GTEST_CRITICAL_SECTION* critical_section_; 

 

Diese beiden Änderungen sollten Ihren obigen Fehler beheben.