opencv installation error while mingw32-make on windows

前端 未结 2 1065
小鲜肉
小鲜肉 2020-12-21 04:00

opencv installation using mingw32-make command in windows 10 platform, then likely end up in getting the below error.

Windows version : 10 OpenCv:3.2.0

Pleas

相关标签:
2条回答
  • 2020-12-21 04:01

    I also faced the same problem while trying to build OpenCV 3.2.0 using mingw32 on Windows10. I searched a bit to find a fix on Github for similar problem. It said the problem was:

    MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two separate (equivalent) structs, instead of using typedef

    So, you have to add another typedef GTEST_CRITICAL_SECTION for _CRITICAL_SECTION and _RTL_CRITICAL_SECTION and use this typedef for either case.

    Here is what to do :

    Edit "ts_gtest.h" which is inside "opencv\sources\modules\ts\include\opencv2\ts\"

    1. Replace this line (probably line 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;
    
    
    

    with

    
    
        #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. Replace this line (probably on line 3060 before your edit - line number would have changed as you modified first part)
    
    
        _RTL_CRITICAL_SECTION* critical_section_;
    
    
    

    with

    
    
        GTEST_CRITICAL_SECTION* critical_section_;
    
    
    

    These two changes should fix your above error.

    0 讨论(0)
  • 2020-12-21 04:08

    It was fixed by using TDM-gcc mingw compiler.

    0 讨论(0)
提交回复
热议问题