Compiling Opencv Error

The first problem you have which is causing the error is that you need to use OpenCV >= 4.7.0 with CUDA >= 12.0 as texture references were removed in that version of CUDA.

The next problem you will have is that OpenCV DNN module (and possible others) is not compatible with CUDA 12.2 at the moment

I would advise you to upgrade to OpenCV 4.8.0 and use CUDA 12.1.