# Enabling Cuda throws error in VTK Build via VS2017

**URL:** https://discourse.vtk.org/t/enabling-cuda-throws-error-in-vtk-build-via-vs2017/3843
**Category:** Support
**Created:** [July 23, 2020, 7:36pm UTC](https://discourse.vtk.org/t/enabling-cuda-throws-error-in-vtk-build-via-vs2017/3843 "2020-07-23T19:36:41Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![McDave17](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mcdave17/32/1778_2.png) [@McDave17](https://discourse.vtk.org/u/McDave17)
#### Post date: [August 6, 2020, 4:46pm UTC](https://discourse.vtk.org/t/enabling-cuda-throws-error-in-vtk-build-via-vs2017/3843/11 "2020-08-06T16:46:18Z")

</div>

So I found the Flags causing the problem:

`/wd4702 /wd4512 /wd4510 /wd4503 `

These are not passed into `-Xcompiler` as they should be.  
Looking at the `Accelerators\Vtkm\CMakeLists.txt` this seems to be supposed to specifically do that:

```auto
if (MSVC)
  set(msvc_warning_flags
    # Generates numerous false positives with template code about unreachable
    # code
    /wd4702
    # Generates numerous warning that implicit assignment operators can't be
    # constructed. This is understood and we don't care.
    /wd4512
    # Generates numerous warning that implicit constructors can't be
    # constructed. This is understood and we don't care.
    /wd4510
    # Generates warnings when decorated names are over 4096 characters
    # This compiler warning is deprecated and no longer occurs with VS2017+.
    # So we suppress for VS2015
    /wd4503
    )
  set(vtkm_msvc_flags)
  foreach (msvc_warning_flag IN LISTS msvc_warning_flags)
    if (TARGET vtkm::cuda)
      list(APPEND vtkm_msvc_flags
        $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${msvc_warning_flag},${msvc_warning_flag}>)
    else ()
      list(APPEND vtkm_msvc_flags
        ${msvc_warning_flag})
    endif ()
  endforeach ()
  vtk_module_compile_options(VTK::AcceleratorsVTKm
    PRIVATE
      ${msvc_warning_flags})
endif ()

```

I’ve tried to fiddle around with this but didn’t seem to manage anything, any suggestions? I see this was a issue on here before:

> [@Unable to build vtkAcceleratorsVTKm with CUDA using VTK Release on Visual Studio 2015 / Windows 10](https://discourse.vtk.org/t/unable-to-build-vtkacceleratorsvtkm-with-cuda-using-vtk-release-on-visual-studio-2015-windows-10/133):
>
> I am getting the following output/error in Visual Studio 2015 when trying to build the vtkAcceleratorsVTKm project generated by cmake: 90\> D:\VTK\_build\Accelerators\Vtkm\>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\nvcc.exe” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86\_amd64” -x cu -I"D:\VTK\_build\Accelerators\Vtkm" -I"D:\VTK\Accelerators\Vtkm" -I"D:\VTK\_build\Common\Core" -I"D:\VTK\Common\Core" -I"D:\VTK\_build\Utilities\KWIML" -I"D:\VTK\Utili…

---

_[View the full topic](https://discourse.vtk.org/t/enabling-cuda-throws-error-in-vtk-build-via-vs2017/3843)._
