Missing lib files while building with Visual Studio 2022

I tried to build OpenCV but Visual Studio only created 3 files in the /build/lib/release folder:
opencv_cudev4100.exp
opencv_cudev4100.lib
opencv_ts4100.lib

and there are a whole bunch of LINK1181 messages about the rest of the .lib files which are missing

as well as a lot of MSB8066 ‘custom build exited with code 1’ errors, as well as a few C1189 ‘unsupported Microsoft Visual Studio Version!’ , even though I am Visual Studio 2022

Your previous post implies you built without errors before, have you upgraded CUDA since then?

Post your CMake command line options, config output and the actual error messages you are getting starting from the first ones (the latter link errors are just a result of the previous build errors).

I was using your OpenCV release built against CUDA 12.4 (I have CUDA 12.1 as required by one of the Python libraries I am using, but it still works)
Now I am trying to build OpenCV with OpenGL enabled

I am using CMake GUI

Commandline options:
-DWITH_CUDA:BOOL="1" -DOPENCV_DNN_CUDA:BOOL="1" -DWITH_OPENGL:BOOL="1" -DCUDA_ARCH_BIN:STRING="8.9" -DOPENCV_EXTRA_MODULES_PATH:PATH="C:/opencv-4.10.0/opencv_contrib-4.x/modules" 

This is the CMake output:

CMake Warning (dev) at CMakeLists.txt:127 (enable_language):
  project() should be called prior to this enable_language() call.
This warning is for project developers.  Use -Wno-dev to suppress it.

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.30/Modules/Platform/Windows-MSVC.cmake:539 (enable_language):
  project() should be called prior to this enable_language() call.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.30/Modules/Platform/Windows-MSVC.cmake:509 (__windows_compiler_msvc_enable_rc)
  C:/Program Files/CMake/share/cmake-3.30/Modules/Platform/Windows-MSVC-CXX.cmake:6 (__windows_compiler_msvc)
  C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeCXXInformation.cmake:48 (include)
  CMakeLists.txt:127 (enable_language)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.30/Modules/Platform/Windows-MSVC.cmake:539 (enable_language):
  project() should be called prior to this enable_language() call.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.30/Modules/Platform/Windows-MSVC.cmake:509 (__windows_compiler_msvc_enable_rc)
  C:/Program Files/CMake/share/cmake-3.30/Modules/Platform/Windows-MSVC-C.cmake:5 (__windows_compiler_msvc)
  C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeCInformation.cmake:48 (include)
  CMakeLists.txt:127 (enable_language)
This warning is for project developers.  Use -Wno-dev to suppress it.

ocv_init_download: OpenCV source tree is not fetched as git repository. 3rdparty resources will be downloaded from github.com by default.
Detected processor: AMD64
libjpeg-turbo: VERSION = 3.0.3, BUILD = opencv-4.10.0-libjpeg-turbo
SIMD extensions disabled: could not find NASM compiler.  Performance will suffer.
Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
OpenJPEG: VERSION = 2.5.0, BUILD = opencv-4.10.0-openjp2-2.5.0
OpenJPEG libraries will be built from sources: libopenjp2 (version "2.5.0")
found Intel IPP (ICV version): 2021.11.0 [2021.11.0]
at: C:/opencv-4.10.0/build/3rdparty/ippicv/ippicv_win/icv
found Intel IPP Integration Wrappers sources: 2021.11.0
at: C:/opencv-4.10.0/build/3rdparty/ippicv/ippicv_win/iw
NVCUVID: Header not found, WITH_NVCUVID requires Nvidia decoding library header C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/include/nvcuvid.h
NVCUVENC: Header not found, WITH_NVCUVENC requires Nvidia encoding library header C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/include/nvEncodeAPI.h
CUDA detected: 12.1
CUDA: Using CUDA_ARCH_BIN=8.9
CUDA: NVCC target flags -gencode;arch=compute_89,code=sm_89;-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 OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find BLAS (missing: BLAS_LIBRARIES) 
Could NOT find LAPACK (missing: LAPACK_LIBRARIES) 
    Reason given by package: LAPACK could not be found because dependency BLAS could not be found.

Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE) 
Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT JVM) 
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
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
Allocator metrics storage type: 'long long'
Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.lasx.cpp
Excluding from source files list: modules/imgproc/src/imgwarp.lasx.cpp
Excluding from source files list: modules/imgproc/src/resize.lasx.cpp
Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': C:/opencv-4.10.0/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
Excluding from source files list: modules/dnn/src/layers/cpu_kernels/conv_winograd_f63.neon.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.rvv.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.lasx.cpp
Excluding from source files list: <BUILD>/modules/dnn/int8layers/layers_common.rvv.cpp
Excluding from source files list: <BUILD>/modules/dnn/int8layers/layers_common.lasx.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_block.neon.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_block.neon_fp16.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_depthwise.rvv.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_depthwise.lasx.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_winograd_f63.neon_fp16.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/fast_gemm_kernels.neon.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/fast_gemm_kernels.lasx.cpp
imgcodecs: OpenEXR codec is disabled in runtime. Details: https://github.com/opencv/opencv/issues/21326
CMake Warning at opencv_contrib-4.x/modules/cudacodec/CMakeLists.txt:26 (message):
  cudacodec::VideoReader requires Nvidia Video Codec SDK.  Please resolve
  dependency or disable WITH_NVCUVID=OFF


CMake Warning at opencv_contrib-4.x/modules/cudacodec/CMakeLists.txt:30 (message):
  cudacodec::VideoWriter requires Nvidia Video Codec SDK.  Please resolve
  dependency or disable WITH_NVCUVENC=OFF


highgui: using builtin backend: WIN32UI
rgbd: Eigen support is disabled. Eigen is Required for Posegraph optimization
Building with NVIDIA Optical Flow API 2.0
Found 'misc' Python modules from C:/opencv-4.10.0/modules/python/package/extra_modules
Found 'mat_wrapper;utils' Python modules from C:/opencv-4.10.0/modules/core/misc/python/package
Found 'gapi' Python modules from C:/opencv-4.10.0/modules/gapi/misc/python/package
Found 'misc' Python modules from C:/opencv-4.10.0/modules/python/package/extra_modules
Found 'mat_wrapper;utils' Python modules from C:/opencv-4.10.0/modules/core/misc/python/package
Found 'gapi' Python modules from C:/opencv-4.10.0/modules/gapi/misc/python/package
CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
  CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
  directory
Call Stack (most recent call first):
  CMakeLists.txt:1180 (include)



General configuration for OpenCV 4.10.0 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            C:/opencv-4.10.0/opencv_contrib-4.x/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2024-11-13T02:51:18Z
    Host:                        Windows 10.0.22631 AMD64
    CMake:                       3.30.0-rc3
    CMake generator:             Visual Studio 17 2022
    CMake build tool:            C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe
    MSVC:                        1941
    Configuration:               Debug Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (18 files):         + SSSE3 SSE4_1
      SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (9 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (38 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (8 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      YES
    C++ standard:                11
    C++ Compiler:                C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe  (ver 19.41.34120.0)
    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:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP  /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:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP  /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/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:precise     /MP   /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:precise     /MP /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 nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/lib/x64
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape signal stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 alphamat cannops cvv freetype hdf java julia matlab ovis python2 sfm viz
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         NO

  Windows RT support:            NO

  GUI:                           WIN32UI
    Win32 UI:                    YES
    OpenGL support:              YES (opengl32 glu32)
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.3.1)
    JPEG:                        build-libjpeg-turbo (ver 3.0.3-70)
      SIMD Support Request:      YES
      SIMD Support:              NO
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         build (ver 1.6.43)
      SIMD Support Request:      YES
      SIMD Support:              YES (Intel SSE)
    TIFF:                        build (ver 42 - 4.6.0)
    JPEG 2000:                   build (ver 2.5.0)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES (prebuilt binaries)
      avcodec:                   YES (58.134.100)
      avformat:                  YES (58.76.100)
      avutil:                    YES (56.70.100)
      swscale:                   YES (5.9.100)
      avresample:                YES (4.0.0)
    GStreamer:                   NO
    DirectShow:                  YES
    Media Foundation:            YES
      DXVA:                      YES

  Parallel framework:            Concurrency

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2021.11.0 [2021.11.0]
           at:                   C:/opencv-4.10.0/build/3rdparty/ippicv/ippicv_win/icv
    Intel IPP IW:                sources (2021.11.0)
              at:                C:/opencv-4.10.0/build/3rdparty/ippicv/ippicv_win/iw
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.19.1)
    Flatbuffers:                 builtin/3rdparty (23.5.9)

  NVIDIA CUDA:                   YES (ver 12.1, CUFFT CUBLAS)
    NVIDIA GPU arch:             89
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 9.2.1)

  OpenCL:                        YES (NVD3D11)
    Include path:                C:/opencv-4.10.0/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/python.exe (ver 3.10.14)
    Libraries:                   C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/libs/python310.lib (ver 3.10.14)
    Limited API:                 NO
    numpy:                       C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/lib/site-packages/numpy/core/include (ver 1.26.4)
    install path:                C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/Lib/site-packages/cv2/python-3.10

  Python (for build):            C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/python.exe

  Java:                          
    ant:                         NO
    Java:                        NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    C:/opencv-4.10.0/build/install
-----------------------------------------------------------------

Configuring done (6.9s)
Generating done (4.5s)

The very first error messages from the Visual Studio output , right before the LINK1181 errors begin appearing:
45>Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/Release/cuda_compile_1_generated_gpu_mat.cu.obj
41>Note: Class cv::Feature2D has more than 1 base class (not supported by Python C extensions)
41>      Bases:  cv::Algorithm, cv::class, cv::Feature2D, cv::Algorithm
41>      Only the first base class will be used
41>Note: Class cv::detail::GraphCutSeamFinder has more than 1 base class (not supported by Python C extensions)
41>      Bases:  cv::detail::GraphCutSeamFinderBase, cv::detail::SeamFinder
41>      Only the first base class will be used
23>opencv_dnn_AVX2.vcxproj -> C:\opencv-4.10.0\build\modules\dnn\opencv_dnn_AVX2.dir\Release\opencv_dnn_AVX2.lib
9>opencv_test_core_AVX2.vcxproj -> C:\opencv-4.10.0\build\modules\core\opencv_test_core_AVX2.dir\Release\opencv_test_core_AVX2.lib
35>libprotobuf.vcxproj -> C:\opencv-4.10.0\build\3rdparty\lib\Release\libprotobuf.lib
45>gpu_mat.cu
45>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include\crt/host_config.h(153): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
45>CMake Error at cuda_compile_1_generated_gpu_mat.cu.obj.Release.cmake:220 (message):
45>  Error generating
45>  C:/opencv-4.10.0/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/Release/cuda_compile_1_generated_gpu_mat.cu.obj
45>
45>
45>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\opencv-4.10.0\build\CMakeFiles\2fda3ee2ddf5782a23601188ad0b055a\opencl_kernels_core.cpp.rule;C:\opencv-4.10.0\modules\core\src\cuda\gpu_mat.cu;C:\opencv-4.10.0\modules\core\src\cuda\gpu_mat_nd.cu' exited with code 1.
45>Done building project "opencv_core.vcxproj" -- FAILED.
46>------ Build started: Project: opencv_version_win32, Configuration: Release x64 ------
47>------ Build started: Project: opencv_version, Configuration: Release x64 ------
48>------ Build started: Project: opencv_signal, Configuration: Release x64 ------
49>------ Build started: Project: opencv_ml, Configuration: Release x64 ------
50>------ Build started: Project: opencv_imgproc, Configuration: Release x64 ------
51>------ Build started: Project: opencv_flann, Configuration: Release x64 ------
52>------ Build started: Project: opencv_cudaarithm, Configuration: Release x64 ------
52>Building NVCC (Device) object modules/cudaarithm/CMakeFiles/cuda_compile_1.dir/src/cuda/Release/cuda_compile_1_generated_absdiff_mat.cu.obj
50>Processing OpenCL kernels (imgproc)
4>opencv_test_core_SSE4_1.vcxproj -> C:\opencv-4.10.0\build\modules\core\opencv_test_core_SSE4_1.dir\Release\opencv_test_core_SSE4_1.lib
52>absdiff_mat.cu
52>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include\crt/host_config.h(153): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
52>CMake Error at cuda_compile_1_generated_absdiff_mat.cu.obj.Release.cmake:220 (message):
52>  Error generating
52>  C:/opencv-4.10.0/build/modules/cudaarithm/CMakeFiles/cuda_compile_1.dir/src/cuda/Release/cuda_compile_1_generated_absdiff_mat.cu.obj
52>
52>
52>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\absdiff_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\absdiff_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\add_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\add_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\add_weighted.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\bitwise_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\bitwise_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\cmp_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\cmp_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\copy_make_border.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\countnonzero.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\div_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\div_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\in_range.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\integral.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\lut.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\math.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\minmax.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\minmax_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\minmaxloc.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\mul_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\mul_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\mul_spectrums.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\norm.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\normalize.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\polar_cart.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\reduce.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\split_merge.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\sub_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\sub_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\sum.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\threshold.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\transpose.cu' exited with code 1.
52>Done building project "opencv_cudaarithm.vcxproj" -- FAILED.
51>cmake_pch.cxx
47>opencv_version.cpp
48>cmake_pch.cxx
46>opencv_version.cpp
49>cmake_pch.cxx
50>cmake_pch.cxx
48>signal_resample.cpp
48>opencv_signal_main.cpp

The errors in the Visual Studio before the ‘LINK1181 cannot open input file’ errors:

Severity Code Description Project File Line Suppression State Details
Error C1189 #error: – unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag ‘-allow-unsupported-compiler’ can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. opencv_core C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include\crt\host_config.h 153
Error MSB8066 Custom build for ‘C:\opencv-4.10.0\build\CMakeFiles\2fda3ee2ddf5782a23601188ad0b055a\opencl_kernels_core.cpp.rule;C:\opencv-4.10.0\modules\core\src\cuda\gpu_mat.cu;C:\opencv-4.10.0\modules\core\src\cuda\gpu_mat_nd.cu’ exited with code 1. opencv_core C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets 254
Error C1189 #error: – unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag ‘-allow-unsupported-compiler’ can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. opencv_cudaarithm C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include\crt\host_config.h 153
Error MSB8066 Custom build for ‘C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\absdiff_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\absdiff_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\add_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\add_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\add_weighted.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\bitwise_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\bitwise_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\cmp_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\cmp_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\copy_make_border.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\countnonzero.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\div_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\div_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\in_range.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\integral.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\lut.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\math.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\minmax.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\minmax_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\minmaxloc.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\mul_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\mul_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\mul_spectrums.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\norm.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\normalize.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\polar_cart.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\reduce.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\split_merge.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\sub_mat.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\sub_scalar.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\sum.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\threshold.cu;C:\opencv-4.10.0\opencv_contrib-4.x\modules\cudaarithm\src\cuda\transpose.cu’ exited with code 1. opencv_cudaarithm C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets 254

#error: – unsupported Microsoft Visual Studio version!

Actually looking it up, it looks like Visual Studio 2022 17.10 and CUDA 12.4 are meant to work with each other… I guess the newest version of Visual Studio is too new for CUDA 12.1

it looks like I will have to pass ‘-allow-unsupported-compiler’ to NVCC

You can try that, from memory I didn’t have any success with that option.

it had an effect, now it gives a different error message instead:

Severity Code Description Project File Line Suppression State Details
Error static assertion failed with error STL1002: Unexpected compiler version, expected CUDA 12.4 or newer. opencv_core C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\yvals_core.h 888

How to install specific version of Visual Studio 2022 - Stack Overflow I have now installed Visual Studio 17.8 LTSC , and I have built OpenCV successfully

1 Like