# Building Open-CV 4.9.0 with Cuda 12.3 in Windows 11

**URL:** https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793
**Category:** Uncategorized
**Tags:** build, cuda
**Created:** [March 13, 2024, 5:59am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793 "2024-03-13T05:59:16Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Ambarish\_K\_U](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ambarish_k_u/32/9913_2.png) [@Ambarish\_K\_U](https://forum.opencv.org/u/Ambarish_K_U)
#### Post date: [March 13, 2024, 5:59am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/1 "2024-03-13T05:59:16Z")

</div>

I have been trying to build Opencv 4.9.0 with cuda 12.3. I am using GPU RTX 4060. I am using cmake GUI. Have tried all the required flags. Still the build is not proper and not able to access CUDA. Can anybody also mention the compatible Microsoft Visual Studio also.

---

<div class="post-metadata">

### Author: ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)
#### Post date: [March 13, 2024, 6:24am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/2 "2024-03-13T06:24:43Z")

</div>

Which version of Visual Studio are you using? The latest should work.

What errors (not warnings) are you seeing? Can you post the text of the errors.

Can you post the text of your CMake configuration output? See “Example of CMake Configuration Output” for an example

> **[Build OpenCV (including Python) with CUDA on Windows: Comprehensive Guide...](https://www.jamesbowley.co.uk/qmd/opencv_cuda_python_windows.html)**
>
> Guide to building OpenCV (including Python bindings) with CUDA (optionally the Nvidia Video Codec SDK and cuDNN) from within Visual Studio or from the command line using the Ninja build system.

---

<div class="post-metadata">

### Author: ![Ambarish\_K\_U](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ambarish_k_u/32/9913_2.png) [@Ambarish\_K\_U](https://forum.opencv.org/u/Ambarish_K_U)
#### Post date: [March 13, 2024, 7:43am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/3 "2024-03-13T07:43:49Z")

</div>

```none
General configuration for OpenCV 4.9.0 =====================================
  Version control: unknown

  Extra modules:
    Location (extra): C:/Ombrulla/General/GPU_OpenCv/opencv_contrib-4.9.0/modules
    Version control (extra): unknown

  Platform:
    Timestamp: 2024-03-13T07:14:12Z
    Host: Windows 10.0.22631 AMD64
    CMake: 3.28.3
    CMake generator: Visual Studio 17 2022
    CMake build tool: C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe
    MSVC: 1939
    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.39.33519/bin/Hostx64/x64/cl.exe (ver 19.39.33522.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:fast /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:fast /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.39.33519/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:fast /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:fast /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.3/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 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
    VTK support: NO

  Media I/O: 
    ZLib: build (ver 1.3)
    JPEG: build-libjpeg-turbo (ver 2.1.3-62)
      SIMD Support Request: YES
      SIMD Support: NO
    WEBP: build (ver encoder: 0x020f)
    PNG: build (ver 1.6.37)
    TIFF: build (ver 42 - 4.2.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:/Ombrulla/General/GPU_OpenCv/build/3rdparty/ippicv/ippicv_win/icv
    Intel IPP IW: sources (2021.11.0)
              at: C:/Ombrulla/General/GPU_OpenCv/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.3, CUFFT CUBLAS NVCUVID NVCUVENC FAST_MATH)
    NVIDIA GPU arch: 89
    NVIDIA PTX archs:

  cuDNN: YES (ver 8.9.7)

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

  Python 3:
    Interpreter: C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/python.exe (ver 3.11.4)
    Libraries: C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/libs/python311.lib (ver 3.11.4)
    numpy: C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/Lib/site-packages/numpy/core/include (ver 1.26.4)
    install path: C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/Lib/site-packages/cv2/python-3.11

  Python (for build): C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/python.exe

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

  Install to: C:/Ombrulla/General/GPU_OpenCv/build/install
-----------------------------------------------------------------

Configuring done (33.2s)

```

---

<div class="post-metadata">

### Author: ![Ambarish\_K\_U](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ambarish_k_u/32/9913_2.png) [@Ambarish\_K\_U](https://forum.opencv.org/u/Ambarish_K_U)
#### Post date: [March 13, 2024, 7:51am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/4 "2024-03-13T07:51:48Z")

</div>

```none
  zlib.vcxproj -> C:\Ombrulla\General\GPU_OpenCv\build\3rdparty\lib\Debug\zlibd.lib
  Processing OpenCL kernels (core)
  Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/Debug/cuda_compile_1_generated_gpu_
  mat.cu.obj
  nvcc fatal : Could not set up the environment for Microsoft Visual Studio using 'C:/Program Files/Microsoft Visual
  Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/../../../../../../../VC/Auxiliary/Build/vcvars64.bat'
  CMake Error at cuda_compile_1_generated_gpu_mat.cu.obj.Debug.cmake:220 (message):
    Error generating
    C:/Ombrulla/General/GPU_OpenCv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/Debug/cuda_compile_1_gener
  ated_gpu_mat.cu.obj

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): e
rror MSB8066: Custom build for 'C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\53c26fc6905121da1759ad6c0141ca49\opencl
_kernels_core.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\core\src\cuda\gpu_mat.cu;C:\Ombrulla\General
\GPU_OpenCv\opencv-4.9.0\modules\core\src\cuda\gpu_mat_nd.cu' exited with code 1. [C:\Ombrulla\General\GPU_OpenCv\build
\modules\core\opencv_core.vcxproj]

```

---

<div class="post-metadata">

### Author: ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)
#### Post date: [March 13, 2024, 8:39am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/5 "2024-03-13T08:39:14Z")

</div>

I would check your environmental variables, see

> <https://stackoverflow.com/questions/55663890/how-to-solve-nvcc-fatal-could-not-set-up-the-environment-for-microsoft-visua>

Additionally make sure you are using the latest commit from the 4.x branch for both the main and contrib repositories. If not you will get the following error

> <https://github.com/opencv/opencv/issues/24789>
>
> \### System Information
> 
> \`\`\`
> \--
> \-- General configuration for OpenCV 4.9.0-dev… =====================================
> \-- Version control: 4.8.0-606-g2e3ccb4e8e-dirty
> \--
> \-- Extra modules:
> \-- Location (extra): C:/lib/opencv\_contrib/modules
> \-- Version control (extra): 4.8.1-55-gc7602a8f
> \--
> \-- Platform:
> \-- Timestamp: 2023-12-28T13:53:30Z
> \-- Host: Windows 10.0.22621 AMD64
> \-- CMake: 3.26.1
> \-- CMake generator: Visual Studio 17 2022
> \-- CMake build tool: C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe
> \-- MSVC: 1935
> \-- 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.35.32215/bin/Hostx64/x64/cl.exe (ver 19.35.32215.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.35.32215/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: alphamat 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 java line\_descriptor mcc ml objdetect optflow phase\_unwrapping photo plot python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured\_light superres surface\_matching text tracking ts video videoio videostab viz wechat\_qrcode xfeatures2d ximgproc xobjdetect xphoto
> \-- Disabled: world
> \-- Disabled by dependency: -
> \-- Unavailable: cannops cvv freetype hdf julia matlab ovis python2
> \-- Applications: tests perf\_tests examples apps
> \-- Documentation: doxygen python javadoc
> \-- Non-free algorithms: YES
> \--
> \-- Windows RT support: NO
> \--
> \-- GUI: WIN32UI
> \-- Win32 UI: YES
> \-- OpenGL support: YES (opengl32 glu32)
> \-- VTK support: YES (ver 9.2.5)
> \--
> \-- Media I/O:
> \-- ZLib: optimized C:/install/zlib/lib/zlib.lib debug C:/install/zlib/lib/zlibd.lib (ver 1.2.13)
> \-- JPEG: build-libjpeg-turbo (ver 2.1.3-62)
> \-- SIMD Support Request: YES
> \-- SIMD Support: NO
> \-- WEBP: build (ver encoder: 0x020f)
> \-- PNG: optimized C:/install/libpng/lib/libpng16.lib debug C:/install/libpng/lib/libpng16d.lib (ver 1.6.40.git)
> \-- TIFF: build (ver 42 - 4.2.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: TBB (ver 2020.3 interface 11103)
> \--
> \-- Other third-party libraries:
> \-- Intel IPP: 2021.11.0 \[2021.11.0\]
> \-- at: C:/lib/build/opencv/3rdparty/ippicv/ippicv\_win/icv
> \-- Intel IPP IW: sources (2021.11.0)
> \-- at: C:/lib/build/opencv/3rdparty/ippicv/ippicv\_win/iw
> \-- Lapack: NO
> \-- OpenVINO: YES (2022.3.0)
> \-- Eigen: YES (ver ..)
> \-- 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: 86
> \-- NVIDIA PTX archs:
> \--
> \-- cuDNN: YES (ver 8.8.0)
> \--
> \-- OpenCL: YES (NVD3D11)
> \-- Include path: C:/lib/opencv/3rdparty/include/opencl/1.2
> \-- Link libraries: Dynamic load
> \--
> \-- Python 3:
> \-- Interpreter: C:/Program Files/Python310/python.exe (ver 3.10.10)
> \-- Libraries: optimized C:/Program Files/Python310/libs/python310.lib debug C:/Program Files/Python310/libs/python310\_d.lib (ver 3.10.10)
> \-- numpy: C:/Users/laurent/AppData/Roaming/Python/Python310/site-packages/numpy/core/include (ver 1.23.5)
> \-- install path: C:/Users/laurent/AppData/Roaming/Python/Python310/site-packages/cv2/python-3.10
> \--
> \-- Python (for build): C:/Program Files/Python310/python.exe
> \--
> \-- Java:
> \-- ant: C:/apache-ant-1.10.13/bin/ant.bat (ver 1.10.13)
> \-- Java: NO
> \-- JNI: C:/Program Files/Java/jdk-17/include C:/Program Files/Java/jdk-17/include/win32 C:/Program Files/Java/jdk-17/include
> \-- Java wrappers: YES (ANT)
> \-- Java tests: YES
> \--
> \-- Install to: C:/install/opencv
> \-- -----------------------------------------------------------------
> \--
> \-- Configuring done (52.8s)
> \-- Generating done (10.0s)
> \-- Build files have been written to: C:/lib/build/opencv
> \`\`\`
> 
> \### Detailed description
> 
> try to build opencv using cmake. Buidl directory is empty 
> 
> \`\`\`
> tmpxft\_00003710\_00000000-10\_test\_split\_merge.cudafe1.cpp
> Building NVCC (Device) object modules/cudev/test/CMakeFiles/opencv\_test\_cudev.dir/debug/opencv\_test\_cudev\_generated\_test\_warp.cu.obj
> test\_warp.cu
> test\_warp.cu
> tmpxft\_00003c0c\_00000000-10\_test\_warp.cudafe1.cpp
> Building NVCC (Device) object modules/cudev/test/CMakeFiles/opencv\_test\_cudev.dir/debug/opencv\_test\_cudev\_generated\_transpose.cu.obj
> transpose.cu
> transpose.cu
> tmpxft\_00004030\_00000000-10\_transpose.cudafe1.cpp
> ;
> test\_main.cpp
> c1xx : fatal error C1083: Impossible d'ouvrir le fichier source : ';' : No such file or directory \[C:\\lib\\build\\opencv\\modules\\cudev\\test\\opencv\_test\_cudev.vcxproj\]
> C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\include\\ostream(414,1): warning C4530: Gestionnaire d'exceptions C++ utilisé, mais les sémantiques de déroulement n'ont pas été activées. Spécifiez /EHsc (compilation du fichier source C:\\lib\\opencv\_contrib\\modules\\cudev\\test\\test\_main.cpp) \[C:\\lib\\build\\opencv\\modules\\cudev\\test\\opencv\_test\_cudev.vcxproj\]
> C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\include\\ostream(407,1): message : pendant la compilation de la fonction membre classe modèle 'std::basic\_ostream\<char,std::char\_traits\<char\>\> &std::basic\_ostream\<char,std::char\_traits\<char\>\>::operator \<\<(double)' (compilation du fichier source C:\\lib\\opencv\_contrib\\modules\\cudev\\test\\test\_main.cpp) \[C:\\lib\\build\\opencv\\modules\\cudev\\test\\opencv\_test\_cudev.vcxproj\]
> C:\\lib\\opencv\\modules\\core\\include\\opencv2/core/utility.hpp(400,5): message : voir la référence à l'instanciation de la fonction modèle 'std::basic\_ostream\<char,std::char\_traits\<char\>\> &std::basic\_ostream\<char,std::char\_traits\<char\>\>::operator \<\<(double)' en cours de compilation (compilation du fichier source C:\\lib\\opencv\_contrib\\modules\\cudev\\test\\test\_main.cpp) \[C:\\lib\\build\\opencv\\modules\\cudev\\test\\opencv\_test\_cudev.vcxproj\]
> C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\include\\ostream(671,75): message : voir la référence à l'instanciation classe modèle 'std::basic\_ostream\<char,std::char\_traits\<char\>\>' en cours de compilation (compilation du fichier source C:\\lib\\opencv\_contrib\\modules\\cudev\\test\\test\_main.cpp) \[C:\\lib\\build\\opencv\\modules\\cudev\\test\\opencv\_test\_cudev.vcxproj\]
> \`\`\`
> 
> 
> \### Steps to reproduce
> 
> use cmake with last opencv and opencv\_contrib : 
> \`\`\`
> \[alalek\](https://github.com/LaurentBerger/opencv/commits?author=alalek)
> alalek
> \[Merge tag '4.9.0'\](https://github.com/LaurentBerger/opencv/commit/2e3ccb4e8e098cf481c938998ff941e320fa4f85)
> \[2e3ccb4\](https://github.com/LaurentBerger/opencv/commit/2e3ccb4e8e098cf481c938998ff941e320fa4f85)
> 
> \`\`\` 
> 
> 
> \[cmakeoutput.txt\](https://github.com/opencv/opencv/files/13787379/cmakeoutput.txt)
> 
> 
> \### Issue submission checklist
> 
> \- \[X\] I report the issue, it's not a question
> \- \[X\] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
> \- \[X\] I updated to the latest OpenCV version and the issue is still there
> \- \[X\] There is reproducer code and related data files (videos, images, onnx, etc)

---

<div class="post-metadata">

### Author: ![Ambarish\_K\_U](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ambarish_k_u/32/9913_2.png) [@Ambarish\_K\_U](https://forum.opencv.org/u/Ambarish_K_U)
#### Post date: [March 14, 2024, 5:24am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/6 "2024-03-14T05:24:35Z")

</div>

```none
  opencv_world_SSE4_2.vcxproj -> C:\Ombrulla\General\GPU_OpenCv\build\modules\world\opencv_world_SSE4_2.dir\Release\opencv_world_SSE4_2.lib
  Processing OpenCL kernels (core)
  Building NVCC (Device) object modules/world/CMakeFiles/cuda_compile_1.dir/__/core/src/cuda/Release/cuda_compile_1_generated_gpu_mat.cu.obj
  nvcc fatal : Could not set up the environment for Microsoft Visual Studio using 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools
  /MSVC/14.29.30133/bin/Hostx64/x64/../../../../../../../VC/Auxiliary/Build/vcvars64.bat'
  CMake Error at cuda_compile_1_generated_gpu_mat.cu.obj.Release.cmake:220 (message):
    Error generating
    C:/Ombrulla/General/GPU_OpenCv/build/modules/world/CMakeFiles/cuda_compile_1.dir/__/core/src/cuda/Release/cuda_compile_1_generated_gpu_mat.cu.obj

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for
 'C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_core.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0
\modules\core\src\cuda\gpu_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\core\src\cuda\gpu_mat_nd.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_con
trib-4.9.0\modules\cudaarithm\src\cuda\absdiff_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\absdiff_scalar.cu;C:\
Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\add_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaari
thm\src\cuda\add_scalar.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\add_weighted.cu;C:\Ombrulla\General\GPU_OpenCv\o
pencv_contrib-4.9.0\modules\cudaarithm\src\cuda\bitwise_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\bitwise_scal
ar.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\cmp_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\module
s\cudaarithm\src\cuda\cmp_scalar.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\copy_make_border.cu;C:\Ombrulla\General
\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\countnonzero.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cud
a\div_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\div_scalar.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.
9.0\modules\cudaarithm\src\cuda\in_range.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\integral.cu;C:\Ombrulla\General
\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\lut.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\math.cu
;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\minmax.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cuda
arithm\src\cuda\minmax_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\minmaxloc.cu;C:\Ombrulla\General\GPU_OpenCv\o
pencv_contrib-4.9.0\modules\cudaarithm\src\cuda\mul_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\mul_scalar.cu;C:
\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\mul_spectrums.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\
cudaarithm\src\cuda\norm.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\normalize.cu;C:\Ombrulla\General\GPU_OpenCv\ope
ncv_contrib-4.9.0\modules\cudaarithm\src\cuda\polar_cart.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\reduce.cu;C:\Om
brulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\split_merge.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaa
rithm\src\cuda\sub_mat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\sub_scalar.cu;C:\Ombrulla\General\GPU_OpenCv\open
cv_contrib-4.9.0\modules\cudaarithm\src\cuda\sum.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\threshold.cu;C:\Ombrull
a\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaarithm\src\cuda\transpose.cu;C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7
699065e2\opencl_kernels_imgproc.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.16sc1.cu;C:\Ombrull
a\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.16sc3.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\c
udafilters\src\cuda\column_filter.16sc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.16uc1.cu;C:\Ombru
lla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.16uc3.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules
\cudafilters\src\cuda\column_filter.16uc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.32fc1.cu;C:\Omb
rulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.32fc3.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modul
es\cudafilters\src\cuda\column_filter.32fc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.32sc1.cu;C:\O
mbrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.32sc3.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\mod
ules\cudafilters\src\cuda\column_filter.32sc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.8uc1.cu;C:\
Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\column_filter.8uc3.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\mod
ules\cudafilters\src\cuda\column_filter.8uc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\filter2d.cu;C:\Ombrulla\Ge
neral\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\median_filter.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters
\src\cuda\row_filter.16sc1.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.16sc3.cu;C:\Ombrulla\General\GPU_
OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.16sc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cu
da\row_filter.16uc1.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.16uc3.cu;C:\Ombrulla\General\GPU_OpenCv\
opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.16uc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_
filter.32fc1.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.32fc3.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_
contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.32fc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.
32sc1.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.32sc3.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib
-4.9.0\modules\cudafilters\src\cuda\row_filter.32sc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.8uc1.cu
;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafilters\src\cuda\row_filter.8uc3.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\mo
dules\cudafilters\src\cuda\row_filter.8uc4.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\bilateral_filter.cu;C:\Ombru
lla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\blend.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\s
rc\cuda\build_point_list.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\canny.cu;C:\Ombrulla\General\GPU_OpenCv\opencv
_contrib-4.9.0\modules\cudaimgproc\src\cuda\clahe.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\color.cu;C:\Ombrulla\
General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\connectedcomponents.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cud
aimgproc\src\cuda\corners.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\debayer.cu;C:\Ombrulla\General\GPU_OpenCv\ope
ncv_contrib-4.9.0\modules\cudaimgproc\src\cuda\generalized_hough.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\gftt.c
u;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\hist.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cuda
imgproc\src\cuda\hough_circles.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\hough_lines.cu;C:\Ombrulla\General\GPU_O
penCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\hough_segments.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\
match_template.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaimgproc\src\cuda\mean_shift.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_cont
rib-4.9.0\modules\cudaimgproc\src\cuda\moments.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudawarping\src\cuda\pyr_down.cu;C:\Ombrulla\
General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudawarping\src\cuda\pyr_up.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudawarping\src\
cuda\remap.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudawarping\src\cuda\resize.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.
0\modules\cudawarping\src\cuda\warp.cu;C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_dnn.cpp.rule;C:\Ombr
ulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\activation_eltwise.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\activation
s.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\bias_activation.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\b
ias_activation_eltwise.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\bias_eltwise_activation.cu;C:\Ombrulla\General\GPU_OpenCv\opencv
-4.9.0\modules\dnn\src\cuda\concat.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\crop_and_resize.cu;C:\Ombrulla\General\GPU_OpenCv\op
encv-4.9.0\modules\dnn\src\cuda\detection_output.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\eltwise_activation.cu;C:\Ombrulla\Gene
ral\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\eltwise_ops.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\fill_copy.cu;C:\Ombrulla\G
eneral\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\fp_conversion.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\grid_nms.cu;C:\Ombrul
la\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\max_unpooling.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\mvn.cu;C:\Ombrull
a\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\normalize.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\padding.cu;C:\Ombrulla
\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\permute.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\prior_box.cu;C:\Ombrulla\
General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\region.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\resize.cu;C:\Ombrulla\Gener
al\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\roi_pooling.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\scale_shift.cu;C:\Ombrulla\
General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\shortcut.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\dnn\src\cuda\slice.cu;C:\Ombrulla\Gene
ral\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_features2d.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\mod
ules\hfs\src\cuda\gslic_seg_engine_gpu.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\hfs\src\cuda\magnitude.cu;C:\Ombrulla\General\GPU_Ope
nCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_photo.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\photo\src\cuda\nlm.
cu;C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_calib3d.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv_c
ontrib-4.9.0\modules\cudacodec\src\cuda\nv12_to_rgb.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudacodec\src\cuda\rgb_to_yv12.cu;C:\Omb
rulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafeatures2d\src\cuda\bf_knnmatch.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cu
dafeatures2d\src\cuda\bf_match.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafeatures2d\src\cuda\bf_radius_match.cu;C:\Ombrulla\Genera
l\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafeatures2d\src\cuda\fast.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudafeatures2d\src\cu
da\orb.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudastereo\src\cuda\disparity_bilateral_filter.cu;C:\Ombrulla\General\GPU_OpenCv\open
cv_contrib-4.9.0\modules\cudastereo\src\cuda\stereobm.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudastereo\src\cuda\stereobp.cu;C:\Omb
rulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudastereo\src\cuda\stereocsbp.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaste
reo\src\cuda\stereosgm.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudastereo\src\cuda\util.cu;C:\Ombrulla\General\GPU_OpenCv\build\CMak
eFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_objdetect.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\
opencl_kernels_rgbd.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_video.cpp.rule;C:\Ombrulla\Gen
eral\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_xfeatures2d.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\m
odules\xfeatures2d\src\cuda\surf.cu;C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_ximgproc.cpp.rule;C:\Om
brulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_bioinspired.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv_contr
ib-4.9.0\modules\cudabgsegm\src\cuda\mog.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudabgsegm\src\cuda\mog2.cu;C:\Ombrulla\General\GPU
_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\NCV.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\NCVBroxOpti
calFlow.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\NCVHaarObjectDetection.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_
contrib-4.9.0\modules\cudalegacy\src\cuda\NCVPyramid.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\NPP_staging.cu;C:\O
mbrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\bm.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\sr
c\cuda\bm_fast.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\calib3d.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-
4.9.0\modules\cudalegacy\src\cuda\ccomponetns.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\fgd.cu;C:\Ombrulla\General
\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\gmg.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudalegacy\src\cuda\needle_
map.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaobjdetect\src\cuda\hog.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\module
s\cudaobjdetect\src\cuda\lbp.cu;C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_optflow.cpp.rule;C:\Ombrull
a\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_stitching.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\module
s\stitching\src\cuda\build_warp_maps.cu;C:\Ombrulla\General\GPU_OpenCv\opencv-4.9.0\modules\stitching\src\cuda\multiband_blend.cu;C:\Ombrulla\General\GPU_O
penCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_tracking.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaop
tflow\src\cuda\farneback.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaoptflow\src\cuda\nvidiaOpticalFlow.cu;C:\Ombrulla\General\GPU_O
penCv\opencv_contrib-4.9.0\modules\cudaoptflow\src\cuda\pyrlk.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\cudaoptflow\src\cuda\tvl1flow.
cu;C:\Ombrulla\General\GPU_OpenCv\build\CMakeFiles\c271695b1da06c75206df5b7699065e2\opencl_kernels_superres.cpp.rule;C:\Ombrulla\General\GPU_OpenCv\opencv_
contrib-4.9.0\modules\superres\src\cuda\btv_l1_gpu.cu;C:\Ombrulla\General\GPU_OpenCv\opencv_contrib-4.9.0\modules\videostab\src\cuda\global_motion.cu' exit
ed with code 1. [C:\Ombrulla\General\GPU_OpenCv\build\modules\world\opencv_world.vcxproj]

```

This is the error that comes now and i am getting this for both Visual Studio 16 2019 and 17 2022

---

<div class="post-metadata">

### Author: ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)
#### Post date: [March 14, 2024, 5:50am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/7 "2024-03-14T05:50:28Z")

</div>

The error is the same it looks like you have something wrong with your environmental variables, see the stack overflow post I linked to.

If I add a " to my path, e.g.

> `set path=""";%path%`

then I get the same error.

Note: If you don’t pass **-DCUDA\_ARCH\_BIN=8.9** you will get this error during the configuration stage.

---

<div class="post-metadata">

### Author: ![Ambarish\_K\_U](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ambarish_k_u/32/9913_2.png) [@Ambarish\_K\_U](https://forum.opencv.org/u/Ambarish_K_U)
#### Post date: [March 14, 2024, 9:22am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/8 "2024-03-14T09:22:54Z")

</div>

Will be very helpfull if you can suggest the steps when building use Cmake GUI because when i am running using Cmd the cude itself is not detected.

set CMAKE\_BUILD\_PARALLEL\_LEVEL=8  
“C:\Program Files\CMake\bin\cmake.exe” -H"C:\Ombrulla\General\GPU\_OpenCv\opencv-4.9.0" -DOPENCV\_EXTRA\_MODULES\_PATH=“C:\Ombrulla\General\GPU\_OpenCv\opencv\_contrib-4.9.0” -B"C:\Ombrulla\General\GPU\_OpenCv\build" -G"Visual Studio 17 2022" -DINSTALL\_TESTS=ON -DINSTALL\_C\_EXAMPLES=ON -DBUILD\_EXAMPLES=ON -DBUILD\_opencv\_world=ON -DENABLE\_CUDA\_FIRST\_CLASS\_LANGUAGE=ON -DWITH\_CUDA=ON -DCUDA\_GENERATION=Auto -DCUDA\_ARCH\_BIN=8.9 -DCUDA\_TOOLKIT\_ROOT\_DIR=“C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3” -DBUILD\_opencv\_python3=ON -DPYTHON3\_INCLUDE\_DIR=“C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/include” -DPYTHON3\_LIBRARY=“C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/Lib” -DPYTHON3\_EXECUTABLE=“C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/python.exe” -DPYTHON3\_NUMPY\_INCLUDE\_DIRS=“C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/Lib/site-packages/numpy/core/include” -DPYTHON3\_PACKAGES\_PATH=“C:/Users/OMBRULLA/AppData/Local/Programs/Python/Python311/Lib/site-packages/”

---

<div class="post-metadata">

### Author: ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)
#### Post date: [March 14, 2024, 9:37am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/9 "2024-03-14T09:37:52Z")

</div>

Did you fix a problem with your environmental variables?

I would not advise using the GUI.

What errors do you get when you use the command line which indicate CUDA is not found?

---

<div class="post-metadata">

### Author: ![Ambarish\_K\_U](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ambarish_k_u/32/9913_2.png) [@Ambarish\_K\_U](https://forum.opencv.org/u/Ambarish_K_U)
#### Post date: [March 16, 2024, 4:31pm UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/10 "2024-03-16T16:31:56Z")

</div>

Syntax error in cmake code at

```
C:/Ombrulla/General/GPU_OpenCv/opencv-4.9.0/cmake/OpenCVUtils.cmake:1491

```

when parsing string

```
PRIVATE;C:\Users\OMBRULLA\AppData\Local\Programs\Python\Python311\libs\python311.lib

```

Invalid character escape ‘\U’.  
Call Stack (most recent call first):  
cmake/OpenCVUtils.cmake:1521 (\_\_ocv\_push\_target\_link\_libraries)  
modules/python/common.cmake:64 (ocv\_target\_link\_libraries)  
modules/python/python3/CMakeLists.txt:20 (include)

– Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3/include (found version “12.3.103”)  
CMake Warning at cmake/OpenCVFindLibsPerf.cmake:49 (message):  
OpenCV is not able to find/configure CUDA SDK (required by WITH\_CUDA).

CUDA support will be disabled in OpenCV build.

To eliminate this warning remove WITH\_CUDA=ON CMake configuration option.

Call Stack (most recent call first):  
CMakeLists.txt:812 (include)

– CUDA: Not detected, when using stand alone installations with the Visual Studio generator the path to the CUDA toolkit should be manually specified with -Tcuda=. e.g. -Tcuda=“C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/vXX.X”

---

<div class="post-metadata">

### Author: ![Ambarish\_K\_U](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ambarish_k_u/32/9913_2.png) [@Ambarish\_K\_U](https://forum.opencv.org/u/Ambarish_K_U)
#### Post date: [March 16, 2024, 7:03pm UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/11 "2024-03-16T19:03:57Z")

</div>

is BLAS and LAPACK needed

---

<div class="post-metadata">

### Author: ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)
#### Post date: [March 17, 2024, 5:55am UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/12 "2024-03-17T05:55:35Z")

</div>

Using your command line arguments I do not get your first error have you resolved the problem with your environmental variables?

I suspect you still have a problem because CMake/Visual Studio is unable to resolve the location of the CUDA toolkit which is specified by the **CUDA\_PATH\_V12\_3** environmental variable. If it is equal to _C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3_ you most likely still have an issue with your envrironmanetal variables.

You can try to force the location with

> ```auto
> -T cuda="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3"
> 
> ```

as suggested by the error but I think you will get problems when you try to build.

---

<div class="post-metadata">

### Author: ![David\_Jacobs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/david_jacobs/32/12117_2.png) [@David\_Jacobs](https://forum.opencv.org/u/David_Jacobs)
#### Post date: [March 1, 2025, 6:43pm UTC](https://forum.opencv.org/t/building-open-cv-4-9-0-with-cuda-12-3-in-windows-11/16793/13 "2025-03-01T18:43:13Z")

</div>

You have to use forward slashes, or double back slashes in all cmake directory inputs. And LAPACK, which includes BLAS, is not needed but it might give you a 5% speed boost for certain CPU bound tasks.
