again, g++ --version, please
( imo you have to switch (dl, install) to a different compiler toolchain, e.g. this, again, you need 64bit, posix, seh support to build opencv )
g++ (tdm64-1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
PS D:\opencv\build\x64\mingw> mingw32-make
[ 0%] Built target opencv_dnn_plugins
[ 0%] Built target opencv_highgui_plugins
[ 0%] Built target jsimd
[ 1%] Built target libopenjp2
[ 1%] Built target opencv_videoio_plugins
[ 1%] Built target ade
[ 3%] Built target libjpeg-turbo
[ 4%] Built target zlib
[ 7%] Built target libtiff
[ 12%] Built target libwebp
[ 12%] Built target quirc
[ 13%] Built target libpng
[ 13%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj
In file included from D:\opencv\opencv-4.7.0\3rdparty\protobuf\src\google\protobuf\arena.cc:42:0:
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In constructor 'constexpr google::protobuf::internal::WrappedMutex::WrappedMutex()':
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:124:29: error: temporary of non-literal type 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' in a constant expression
constexpr WrappedMutex() {}
^
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note: 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' is not literal because:
class CallOnceInitializedMutex {
^
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note: 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' has a non-trivial destructor
mingw32-make[2]: *** [3rdparty\protobuf\CMakeFiles\libprotobuf.dir\build.make:91: 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:2159: 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2
PS D:\opencv\build\x64\mingw> gcc --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.