I am experiencing the same trouble, but am working with code in C. I have had some luck narrowing down the problem. I just started using VisualStudio a few days ago and only learned C a week ago, so please forgive me if my understanding of everything is not 100% correct.
NVCC requires a host compiler to operate. VisualStudio is the preferred host compiler; I am not sure if others are supported. The cl.exe referred to in this error is the executable file generated by VisualStudio. This file needs to be located in the same execution path as the NVCC compiler (it can be called from a different location with a little more work). My understanding gets a little sketchy at this point.
I have tried uninstalling/reinstalling the CUDA software several times but the sample codes work fine so I don’t think that is the problem for me. My guess is that the way we are implementing our codes is not correctly using the NVCC compiler.
Like I said, I am working on fixing this problem myself so I don’t have much more to offer. Hopefully this information can get one of us a step further. I’ll keep you posted on any developments.
Ok, I got mine working and as promised here is how I did it:
If everything is installed correctly you are probably making the same mistake that I did. I was trying compile the code from the windows command prompt. This seems logical, but the reason you are getting the cl.exe error. You actually have to use the Visual Studio Command Prompt. Compiling your code using this command prompt will allow it to access the cl.exe compiler and run the code appropriately. The command prompts are the same.