Cudev build error with OpenCV 4.6.0 + CUDA

Hello,

I’m trying to build OpenCV 4.6.0 with CUDA support using cmake with the following batch script:

@echo off

RMDIR /S /Q build

SET BUILD_TYPE=Release
SET CUDNN_PATH=%USERPROFILE%/Desktop/8.0.5_cuda10.1_win10/cuda
SET OPENCV_CONTRIB_PATH=%USERPROFILE%/Documents/Git/opencv_contrib

cmake -S . -B build -G "Visual Studio 14 2015" -A x64 ^
-D CMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-D WITH_CUDA=ON ^
-D CUDA_ARCH_PTX="" ^
-D CUDA_ARCH_BIN="7.5" ^
-D WITH_CUBLAS=ON ^
-D WITH_CUDNN=ON ^
-D ENABLE_FAST_MATH=ON ^
-D CUDA_FAST_MATH=ON ^
-D OPENCV_DNN_CUDA=ON ^
-D OPENCV_EXTRA_MODULES_PATH="%OPENCV_CONTRIB_PATH%/modules" ^
-D BUILD_opencv_world=OFF ^
-D BUILD_opencv_gapi=OFF ^
-D WITH_LAPACK=OFF ^
-D WITH_VTK=OFF ^
-D BUILD_opencv_videoio=OFF ^
-D WITH_FFMPEG=OFF ^
-D WITH_QT=OFF ^
-D WITH_OPENMP=ON ^
-D WITH_OPENGL=ON ^
-D WITH_FFMPEG=OFF ^
-D WITH_GSTREAMER=OFF ^
-D BUILD_opencv_python3=OFF ^
-D BUILD_opencv_python2=OFF ^
-D BUILD_opencv_java=OFF ^
-D WITH_GTK=OFF ^
-D BUILD_TESTS=OFF ^
-D BUILD_PERF_TESTS=OFF ^
-D BUILD_EXAMPLES=OFF ^
-D CUDNN_LIBRARY="%CUDNN_PATH%/lib" ^
-D CUDNN_INCLUDE_DIR="%CUDNN_PATH%/include" ^
-D CUDA_cublas_LIBRARY="%CUDA_PATH%/lib/x64/cublas.lib" ^
-D CUDA_cufft_LIBRARY="%CUDA_PATH%/lib/x64/cufft.lib" ^
-D CUDA_nppc_LIBRARY="%CUDA_PATH%/lib/x64/nppc.lib" ^
-D CUDA_nppial_LIBRARY="%CUDA_PATH%/lib/x64/nppial.lib" ^
-D CUDA_nppicc_LIBRARY="%CUDA_PATH%/lib/x64/nppicc.lib" ^
-D CUDA_nppicom_LIBRARY="%CUDA_PATH%/lib/x64/nppicom.lib" ^
-D CUDA_nppidei_LIBRARY="%CUDA_PATH%/lib/x64/nppidei.lib" ^
-D CUDA_nppif_LIBRARY="%CUDA_PATH%/lib/x64/nppif.lib" ^
-D CUDA_nppig_LIBRARY="%CUDA_PATH%/lib/x64/nppig.lib" ^
-D CUDA_nppim_LIBRARY="%CUDA_PATH%/lib/x64/nppim.lib" ^
-D CUDA_nppist_LIBRARY="%CUDA_PATH%/lib/x64/nppist.lib" ^
-D CUDA_nppisu_LIBRARY="%CUDA_PATH%/lib/x64/nppisu.lib" ^
-D CUDA_nppitc_LIBRARY="%CUDA_PATH%/lib/x64/nppitc.lib" ^
-D CUDA_npps_LIBRARY="%CUDA_PATH%/lib/x64/npps.lib"

IF %ERRORLEVEL% NEQ 0 (
  echo "Previous command execution failed."
)

cmake --build build --config %BUILD_TYPE%

I’m working on Windows 10 with Visual Studio 2015, CMake 3.18.1 and CUDA 10.1.

Without the lines 3 to 11, everything works perfectly fine. However, with activated CUDA, the cmake --build command fails with the following error:

LINK : fatal error LNK1104: cannot open file 'lib.lib' [%USERPROFILE%\Documents\opencv\build\modules\cudev\opencv_cudev.vcxproj]

Generating the Visual Studio project using cmake is successful:

-- Selecting Windows SDK version 10.0.10586.0 to target Windows 10.0.19042.
-- The CXX compiler identification is MSVC 19.0.24218.1
-- The C compiler identification is MSVC 19.0.24218.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detected processor: AMD64
-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.7")
-- Found PythonInterp: %USERPROFILE%/Anaconda3/python.exe (found suitable version "3.9.7", minimum required is "3.2")
-- Found PythonLibs: %USERPROFILE%/Anaconda3/libs/python39.lib (found suitable exact version "3.9.7")
-- Performing Test HAVE_CXX_FP:FAST
-- Performing Test HAVE_CXX_FP:FAST - Success
-- Performing Test HAVE_C_FP:FAST
-- Performing Test HAVE_C_FP:FAST - Success
-- Performing Test HAVE_CPU_SSE3_SUPPORT (check file: cmake/checks/cpu_sse3.cpp)
-- Performing Test HAVE_CPU_SSE3_SUPPORT - Success
-- Performing Test HAVE_CPU_SSSE3_SUPPORT (check file: cmake/checks/cpu_ssse3.cpp)
-- Performing Test HAVE_CPU_SSSE3_SUPPORT - Success
-- Performing Test HAVE_CPU_SSE4_1_SUPPORT (check file: cmake/checks/cpu_sse41.cpp)
-- Performing Test HAVE_CPU_SSE4_1_SUPPORT - Success
-- Performing Test HAVE_CPU_POPCNT_SUPPORT (check file: cmake/checks/cpu_popcnt.cpp)
-- Performing Test HAVE_CPU_POPCNT_SUPPORT - Success
-- Performing Test HAVE_CPU_SSE4_2_SUPPORT (check file: cmake/checks/cpu_sse42.cpp)
-- Performing Test HAVE_CPU_SSE4_2_SUPPORT - Success
-- Performing Test HAVE_CXX_ARCH:AVX (check file: cmake/checks/cpu_fp16.cpp)
-- Performing Test HAVE_CXX_ARCH:AVX - Success
-- Performing Test HAVE_CXX_ARCH:AVX2 (check file: cmake/checks/cpu_avx2.cpp)
-- Performing Test HAVE_CXX_ARCH:AVX2 - Success
-- Performing Test HAVE_CXX_ARCH:AVX512 (check file: cmake/checks/cpu_avx512.cpp)
-- Performing Test HAVE_CXX_ARCH:AVX512 - Failed
-- AVX_512F is not supported by C++ compiler
-- AVX512_COMMON is not supported by C++ compiler
-- AVX512_SKX is not supported by C++ compiler
-- Dispatch optimization AVX512_SKX is not available, skipped
-- Performing Test HAVE_CPU_BASELINE_FLAGS
-- Performing Test HAVE_CPU_BASELINE_FLAGS - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_SSE4_1
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_SSE4_1 - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_SSE4_2
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_SSE4_2 - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_FP16
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_FP16 - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX2
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX2 - Success
-- Performing Test HAVE_CXX_W15240
-- Performing Test HAVE_CXX_W15240 - Success
-- Performing Test HAVE_C_W15240
-- Performing Test HAVE_C_W15240 - Success
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for _aligned_malloc
-- Looking for _aligned_malloc - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Searching 16 bit integer - Using unsigned short
-- Check if the system is big endian - little endian
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
-- Looking for fseeko
-- Looking for fseeko - not found
-- Check size of off64_t
-- Check size of off64_t - failed
-- libjpeg-turbo: VERSION = 2.1.2, BUILD = opencv-4.6.0-dev-libjpeg-turbo-debug
-- Check size of size_t
-- Check size of size_t - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Looking for include file intrin.h
-- Looking for include file intrin.h - found
-- Looking for assert.h
-- Looking for assert.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for io.h
-- Looking for io.h - found
-- Looking for limits.h
-- Looking for limits.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for search.h
-- Looking for search.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Performing Test C_HAS_inline
-- Performing Test C_HAS_inline - Success
-- Check size of signed short
-- Check size of signed short - done
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Check size of signed int
-- Check size of signed int - done
-- Check size of unsigned int
-- Check size of unsigned int - done
-- Check size of signed long
-- Check size of signed long - done
-- Check size of signed long long
-- Check size of signed long long - done
-- Check size of unsigned long long
-- Check size of unsigned long long - done
-- Check size of unsigned char *
-- Check size of unsigned char * - done
-- Check size of ptrdiff_t
-- Check size of ptrdiff_t - done
-- Looking for memmove
-- Looking for memmove - found
-- Looking for setmode
-- Looking for setmode - found
-- Looking for strcasecmp
-- Looking for strcasecmp - not found
-- Looking for strchr
-- Looking for strchr - found
-- Looking for strrchr
-- Looking for strrchr - found
-- Looking for strstr
-- Looking for strstr - found
-- Looking for strtol
-- Looking for strtol - found
-- Looking for strtol
-- Looking for strtol - found
-- Looking for strtoull
-- Looking for strtoull - found
-- Looking for lfind
-- Looking for lfind - found
-- Performing Test HAVE_SNPRINTF
-- Performing Test HAVE_SNPRINTF - Success
-- Check if the system is big endian
-- Searching 16 bit integer
-- Searching 16 bit integer - Using unsigned short
-- Check if the system is big endian - little endian
-- Performing Test HAVE_C_STD_C99
-- Performing Test HAVE_C_STD_C99 - Failed
-- Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
-- OpenJPEG: VERSION = 2.4.0, BUILD = opencv-4.6.0-dev-openjp2-2.4.0-debug
-- Check if the system is big endian
-- Searching 16 bit integer
-- Searching 16 bit integer - Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for stdio.h
-- Looking for stdio.h - found
-- Looking for math.h
-- Looking for math.h - found
-- Looking for float.h
-- Looking for float.h - found
-- Looking for time.h
-- Looking for time.h - found
-- Looking for stdarg.h
-- Looking for stdarg.h - found
-- Looking for ctype.h
-- Looking for ctype.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for strings.h
-- Looking for strings.h - not found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for include file malloc.h
-- Looking for include file malloc.h - found
-- Looking for _aligned_malloc
-- Looking for _aligned_malloc - found
-- Looking for posix_memalign
-- Looking for posix_memalign - not found
-- Looking for memalign
-- Looking for memalign - not found
-- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.4.0")
-- IPPICV: Downloading ippicv_2020_win_intel64_20191018_general.zip from https://raw.githubusercontent.com/opencv/opencv_3rdparty/a56b6ac6f030c312b2dce17430eef13aed9af274/ippicv/ippicv_2020_win_intel64_20191018_general.zip
-- found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
-- at: %USERPROFILE%/Documents/opencv/build/3rdparty/ippicv/ippicv_win/icv
-- found Intel IPP Integration Wrappers sources: 2020.0.0
-- at: %USERPROFILE%/Documents/opencv/build/3rdparty/ippicv/ippicv_win/iw
-- Found CUDNN: %USERPROFILE%/Desktop/8.0.5_cuda10.1_win10/cuda/lib (found suitable version "8.0.5", minimum required is "7.5")
-- CUDA detected: 10.1
-- CUDA: Using CUDA_ARCH_BIN=7.5
-- CUDA NVCC target flags: -gencode;arch=compute_75,code=sm_75;-D_FORCE_INLINES
-- CUDA: MSVS generator is detected. Disabling CMake re-run checks (CMAKE_SUPPRESS_REGENERATION=ON). You need to run CMake manually if updates are required.
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- ADE: Downloading v0.1.1f.zip from https://github.com/opencv/ade/archive/v0.1.1f.zip
-- Looking for mfapi.h
-- Looking for mfapi.h - found
-- Looking for d3d11_4.h
-- Looking for d3d11_4.h - found
-- Module opencv_alphamat disabled because the following dependencies are not found: Eigen
-- freetype2:   NO
-- harfbuzz:    NO
-- Julia not found. Not compiling Julia Bindings.
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
-- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
-- Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
-- Tesseract:   NO
-- Module opencv_cudacodec disabled because opencv_videoio dependency can't be resolved!
-- Allocator metrics storage type: 'long long'
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': %USERPROFILE%/Documents/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.rvv.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/int8layers/layers_common.avx512_skx.cpp
-- imgcodecs: OpenEXR codec is disabled in runtime. Details: https://github.com/opencv/opencv/issues/21326
-- wechat_qrcode: Downloading detect.caffemodel from https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/a8b69ccc738421293254aec5ddb38bd523503252/detect.caffemodel
-- wechat_qrcode: Downloading detect.prototxt from https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/a8b69ccc738421293254aec5ddb38bd523503252/detect.prototxt
-- wechat_qrcode: Downloading sr.caffemodel from https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/a8b69ccc738421293254aec5ddb38bd523503252/sr.caffemodel
-- wechat_qrcode: Downloading sr.prototxt from https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/a8b69ccc738421293254aec5ddb38bd523503252/sr.prototxt
-- highgui: using builtin backend: WIN32UI
-- rgbd: Eigen support is disabled. Eigen is Required for Posegraph optimization
-- xfeatures2d/boostdesc: Downloading boostdesc_bgm.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i
-- xfeatures2d/boostdesc: Downloading boostdesc_bgm_bi.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_bi.i
-- xfeatures2d/boostdesc: Downloading boostdesc_bgm_hd.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_hd.i
-- xfeatures2d/boostdesc: Downloading boostdesc_binboost_064.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_064.i
-- xfeatures2d/boostdesc: Downloading boostdesc_binboost_128.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_128.i
-- xfeatures2d/boostdesc: Downloading boostdesc_binboost_256.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_256.i
-- xfeatures2d/boostdesc: Downloading boostdesc_lbgm.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_lbgm.i
-- xfeatures2d/vgg: Downloading vgg_generated_48.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_48.i
-- xfeatures2d/vgg: Downloading vgg_generated_64.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_64.i
-- xfeatures2d/vgg: Downloading vgg_generated_80.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_80.i
-- xfeatures2d/vgg: Downloading vgg_generated_120.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_120.i
-- data: Downloading face_landmark_model.dat from https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat
-- NVIDIA_OPTICAL_FLOW: Downloading edb50da3cf849840d680249aa6dbef248ebce2ca.zip from https://github.com/NVIDIA/NVIDIAOpticalFlowSDK/archive/edb50da3cf849840d680249aa6dbef248ebce2ca.zip
-- Building with NVIDIA Optical Flow API 2.0
-- Found 'misc' Python modules from %USERPROFILE%/Documents/opencv/modules/python/package/extra_modules
-- Found 'mat_wrapper;utils' Python modules from %USERPROFILE%/Documents/opencv/modules/core/misc/python/package
--
-- General configuration for OpenCV 4.6.0-dev =====================================
--   Version control:               4.6.0-18-g734e309b3e
--
--   Extra modules:
--     Location (extra):            %USERPROFILE%/Documents/Git/opencv_contrib/modules
--     Version control (extra):     4.6.0-14-g3951e033
--
--   Platform:
--     Timestamp:                   2022-06-29T10:41:34Z
--     Host:                        Windows 10.0.19042 AMD64
--     CMake:                       3.18.1
--     CMake generator:             Visual Studio 14 2015
--     CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
--     MSVC:                        1900
--     Configuration:               Debug Release
--
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
--       SSE4_1 (14 files):         + SSSE3 SSE4_1
--       SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (29 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ standard:                11
--     C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.24218.1)
--     C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:fast     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP -openmp  /MD /O2 /Ob2 /DNDEBUG
--     C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:fast     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP -openmp  /MDd /Zi /Ob0 /Od /RTC1
--     C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
--     C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:fast     /MP -openmp   /MD /O2 /Ob2 /DNDEBUG
--     C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:fast     /MP -openmp /MDd /Zi /Ob0 /Od /RTC1
--     Linker flags (Release):      /machine:x64  /INCREMENTAL:NO
--     Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL
--     ccache:                      NO
--     Precompiled headers:         YES
--     Extra dependencies:          cudart_static.lib nppc.lib nppial.lib nppicc.lib nppicom.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/lib/x64 -LIBPATH:%USERPROFILE%/Desktop/8.0.5_cuda10.1_win10/cuda
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 aruco barcode bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    gapi python3 videoio world
--     Disabled by dependency:      cudacodec
--     Unavailable:                 alphamat cvv freetype hdf java julia matlab ovis python2 sfm ts viz
--     Applications:                apps
--     Documentation:               NO
--     Non-free algorithms:         NO
--
--   Windows RT support:            NO
--
--   GUI:                           WIN32UI
--     Win32 UI:                    YES
--     OpenGL support:              YES (opengl32 glu32)
--
--   Media I/O:
--     ZLib:                        build (ver 1.2.12)
--     JPEG:                        build-libjpeg-turbo (ver 2.1.2-62)
--     WEBP:                        build (ver encoder: 0x020f)
--     PNG:                         build (ver 1.6.37)
--     TIFF:                        build (ver 42 - 4.2.0)
--     JPEG 2000:                   build (ver 2.4.0)
--     OpenEXR:                     build (ver 2.3.0)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
--
--   Video I/O:
--     DC1394:                      NO
--     DirectShow:                  YES
--     Media Foundation:            YES
--       DXVA:                      YES
--
--   Parallel framework:            OpenMP
--
--   Trace:                         YES (with Intel ITT)
--
--   Other third-party libraries:
--     Intel IPP:                   2020.0.0 Gold [2020.0.0]
--            at:                   %USERPROFILE%/Documents/opencv/build/3rdparty/ippicv/ippicv_win/icv
--     Intel IPP IW:                sources (2020.0.0)
--               at:                %USERPROFILE%/Documents/opencv/build/3rdparty/ippicv/ippicv_win/iw
--     Eigen:                       NO
--     Custom HAL:                  NO
--     Protobuf:                    build (3.19.1)
--
--   NVIDIA CUDA:                   YES (ver 10.1, CUFFT CUBLAS FAST_MATH)
--     NVIDIA GPU arch:             75
--     NVIDIA PTX archs:
--
--   cuDNN:                         YES (ver 8.0.5)
--
--   OpenCL:                        YES (NVD3D11)
--     Include path:                %USERPROFILE%/Documents/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python (for build):            %USERPROFILE%/Anaconda3/python.exe
--
--   Java:
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Install to:                    %USERPROFILE%/Documents/opencv/build/install
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: %USERPROFILE%/Documents/opencv/build

this should point to a .lib file , not to a folder

1 Like

Just a side note, if it was me I would use `CUDA_TOOLKIT_ROOT_DIR, e.g.

-DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7

instead of specifying every library, as well as reducing the chance of errors and saving your fingers it will mean that when the CUDA toolkit includes new libs which OpenCV uses they will automatically get located for you . In this case you would also have to add the location of cuDNN, but I would also suggest extracting the cuDNN install to the CUDA directory, that way the cuDNN dll’s will also automatically be on the system path as well.

1 Like

Thank you. This was the mistake. It’s working now.