[Resolved] VS2022 CUDA Memory Exception Error

System Informations

  • OpenCV => 4.7.0
  • OpenCV Modules => 4.7.0
  • Cuda => v12.1
  • CUDNN => 8.9.0
  • OS => Windows 64bit
  • IDE => Visual Studio 2022
  • GPU => NVIDIA RTX 2080

Description
I have recently installed openCV with Cuda and DNN support, I did this with Cmake,
The Cmake installation didn’t return me any error messages.

When I try to execture the program below, an error pops up

The Program :

> #include <iostream>
> #include <opencv2/dnn.hpp>
> #include <opencv2/imgproc.hpp>
> #include <opencv2/highgui.hpp>
> #include <opencv2/core/cuda.hpp>
> 
> int main()
> {
> 	cv::cuda::printCudaDeviceInfo(0);
> }

The error :

Unhandled exception at 0x00007FFFEAACCB69 in OpenCVGPUTest.exe: Microsoft C++ exception: cv::Exception at memory location 0x0000009AB04FF540.

I have search everywhere and i can’t find anything on this error.
I’ve tried to reinstall everything multiple times, it didn’t do anything.

Note
I’m a beginner with openCV and CMAKE, so if there is any informations missing please let me know so that I can provide them.

Thank you.

EDIT :

I just found a fix for it !
I put those two files into my solution where my .exe is located :

opencv_world470.dll
opencv_world470.lib

catch the exception, inspect it. what does it say?

There is what it return me :

error: (-216:No CUDA support) The library is compiled without CUDA support in function ‘throw_no_cuda’

I just found a fix for it !
I put those two files into my solution where my .exe is located :

opencv_world470.dll
opencv_world470.lib

Thanks a lot for your help !
(I didn’t know how to catch the exception and inspect it so i didn’t have the error code)