How to enable C++17 in your MSVC CUDA project

The way to use C++17 in your MSVC CUDA project

  1. Open your CUDA project in Visual Studio.

  2. Right-click on your project in the Solution Explorer and select “Properties” from the context menu.

  3. In the left-hand pane of the project properties window, select “CUDA C/C++” > “Command Line”.

  4. Write the following in the additional options.

-std=c++17 -Xcompiler "/std:c++17"


If you encounter nvcc compilation warnings, write the following as additional options.

-std=c++17 -Xcompiler "/std:c++17" --expt-relaxed-constexpr -Xcudafe --diag_suppress=20012 -Xcudafe --diag_suppress=1394