example code in Visual Studio 2015 doesn't compile: MSB3721 exited with code 2

Hello,

I am trying to run anything on my GPU (GeForce GT645M).
I have installed CUDA toolkit 10.1, and also newest driver NVIDIA GeForceGT 645M version 25.21.14.2531 [09.04.2019].

I try to create simple project in Visual Studio Community 2015 (tried VS 2017 as well), didn’t really change anything in that sample code that generates there.

But when I try to run it, I get MSB3721 error:

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe” -gencode=arch=compute_35,code=“sm_35,compute_35” --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64” -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -g -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler “/EHsc /W3 /nologo /Od /Fdx64\Debug\vc140.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj “C:\Users\kinia\Desktop\FirstProject\FirstProject\kernel.cu”” exited with code 2.
1> Done executing task “CudaCompile” – FAILED. (TaskId:40)

I tried to look for exact reason of this error by setting VS output verbosity to detailed, and browsing through the internet, but I still cannot find what is wrong.

The full VS output is here:
http://wklejto.pl/744264
And the code (really some sample code from VS, I didn’t change anything) here:
http://www.wklejto.pl/744267

Anyone can tell why I can’t run it?
As I said, it isn’t even my code but just an example from Visual Studio.

Try changing the VS output from Detailed to Diagnostic. We need to see something more on line 2 below:

1>         "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc140.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj "C:\Users\kinia\Desktop\FirstProject\FirstProject\kernel.cu"
1>   1:2>
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc140.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj "C:\Users\kinia\Desktop\FirstProject\FirstProject\kernel.cu"" exited with code 2.
1>       Done executing task "CudaCompile" -- FAILED.

Here’s the ending part of output after changing it to Diagnositc:
http://www.wklejto.pl/744286

It doesn’t seem to reveal more to me about CudaCompile task failure, but maybe I just can’t see it.

I also tried to install older toolkit (8.0.44), but it didn’t help either.

No, the output I was looking for seems to be missing.

Can you build a CUDA sample project successfully?

I tried to run “Samples_vs2015”, and again, same problem: it doesn’t want to compile, shows MSB3721 error and very similar output.

Here are last lines of it (verbosity still set to ‘Diagnostic’):
http://wklejto.pl/744290

So your install is broken then, I would guess. It’s usually a good idea to perform the verification steps listed in the windows install guide, before proceeding with your own experiments.