Opencv4.5.2 build error :OpenCVCompilerOptimizations.cmake:593: error: Compiler doesn't support baseline optimization flags: cmake/OpenCVCompilerOptions.cmake:311 (ocv_compiler_optimization_options) CMakeLists.txt:617 (include)

The compiler is Desktop_Qt_5_14_2_MinGW_64_bit-Release.
Can I disbale those lines:
if(NOT HAVE_CPU_BASELINE_FLAGS)
message(FATAL_ERROR “Compiler doesn’t support baseline optimization flags: ${CPU_BASELINE_FLAGS}”)
endif()
Does it work after disable?

what does

g++ --version

report, exactly ?

meh, the mingw c++ compiler IS named g++, even on win …

while you technically can build opencv libs without optimizatios, it will be grossly slow.
the toolchain, that comes with qt, quite often was not able to build opencv, next problem will be: does it support posix threads ?

maybe your best bet is to ditch that, and download a more recent standalone mingw64 (w. posix support !) instead, or switch to msvc entirely (where you also could use prebuilt libs !!).

aand oh, wait, why opencv 4.5.2 even ? that’s far too old !

I’m learning about an embedded project for a facial recognition time and attendance system based on a video. The video used 4.5.2, so I used opencv4.5.2 in order to reduce the trouble, but the qt used in the video is 5.12 version, but I don’t know the specific compiler.

so you found an outdated video, using outdated tools, and have problems, which are no more relevant to anyone else.

take it as a lesson, no ?

Yes. Thanks for your help.

you can stick to whatever specific version someone wrote the guide for, or you can use the latest version. it’s a tradeoff. using the specific old version, you can be more confident that it’ll work exactly as it worked at the time the author wrote the guide and code. however, something else in the environment might have changed since then (operating systems, compilers), but the author failed to specify that, so now the old version might no longer work. using the latest version will probably work better with your current environment, but APIs change and you might have to change the code that the author wrote a long while ago.

wrestling with C++ is a big challenge for a beginner, especially if your goal isn’t to wrestle with C++, but to get stuff done. then you tried to involve Qt, which adds more complexity. Qt requires you to involve MinGW, adding yet more complexity (on a Windows host, OpenCV prefers MSVC).

you should avoid all that. look for learning material that uses Python.