Cmake opencv error: "Found OpenCV Windows Pack but it has no binaries compatible with your configuration."

How can I fix this error, anybody can help me out ?
Error log :
CMake Warning at C:/library/opencv/build/OpenCVConfig.cmake:190 (message):
Found OpenCV Windows Pack but it has no binaries compatible with your
configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)

CMake Error at CMakeLists.txt:7 (find_package):
Found package configuration file:

C:/library/opencv/build/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package “OpenCV” is considered to be
NOT FOUND.

so, what is your ‘architecture’, and what exactly did you download ?

also show your CMakeList.txt, please.

Thank you very much for your kindness, I would show more detial below.

This is my architecture :
OpenCV ARCH: x64
OpenCV RUNTIME: mingw
OpenCV STATIC: OFF

I download the exe from official webside “opencv-4.8.0-windows.exe”

This is my cmake error screenshot:
image

And my CMakeLists.txt is:

cmake_minimum_required(VERSION 3.10)
project(Rasterizer)


set(OpenCV_DIR "C:/library/opencv/build/x64/mingw/lib")
set(CMAKE_PREFIX_PATH "C:/library/opencv/build")
find_package(OpenCV REQUIRED)

set(CMAKE_CXX_STANDARD 17)


include_directories("C:/Program Files (x86)/Eigen3/include/eigen3")

add_executable(Rasterizer main.cpp rasterizer.hpp rasterizer.cpp Triangle.hpp Triangle.cpp)
target_link_libraries(Rasterizer ${OpenCV_LIBRARIES})

bad luck. prebuild libs are for Visual Studio ONLY
change compiler or build libs from src first.
and which mingw, exactly ?

also, use search box above (mingw) you’ll find some receipts.

Here is my mingw version:

gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

well, at least that can build the opencv libs, tried & tested.

Should I use visual studio to build the opencv? Not I use mingw

IF you have a (recent) visual studio, you can use the prebuilt libs
(but then i dont really understand your question …)
if you only have mingw, you need to build from src first

I have built opencv from src, and use “mingw32-make and mingw32-install”. But I still get error when I use opencv, Can you tell me how do I know if my opencv is installed correctly?

sorry, most of the confusion here is my bad, did not read #1 properly.

can you try to run make install again, and point it to a different (from ‘build’) folder ? then point your local cmake file to that ?
(‘build’ is a terrible location to install)