CUDA 9 unsupported error with Visual Studio 2017

I'm using CUDA 9.2 and VS 2017 (Version 15.7.5). Simply Modifying host_config.h (usually under C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.*\include\crt, can be found in the VS output from build) works for me.

Change the line

#if _MSC_VER < 1600 || _MSC_VER > 1913

to

#if _MSC_VER < 1600 || _MSC_VER > 1914

or something similar, based on the version of cl.exe


After some painful time, I was able to solve the problem. Here is the answer for those who have a similar problem:

1) Make sure that you have VC++ 2015.3 v140 toolset (can be installed either from web or Visual Studio installer)

2) In the project properties (general) -> Platform toolset choose Visual Studio 2015 (v140).

Edit (5/21/2018): I've just updated Visual studio 2017 to the latest version 15.7.1. From now on, I can choose VS 2017 v141 toolset and it works fine.