Compile CUDA without Visual Studio - "Cannot find compiler cl.exe in path"

Update

As noted in the comments, versions of the SDK after Windows 7's do not include the build tools. If you want to use Microsoft's most recent tools you have to install Visual Studio. Once installed, you can use the tools from the command-line.

At the moment the free versions are the "Community" versions, e.g. Microsoft Visual Studio Community 2015.

You can continue to develop apps for Windows 7 and earlier (and they will run on later versions of Windows) using the old SDK tools as I described before:

Original Answer

If you desperately want to avoid Visual Studio, download and install the Windows SDK. This contains (more or less) the same build tools as Visual Studio.

Then run the Windows SDK Command Prompt (which you'll find on the start menu under Microsoft Windows SDK) to set the path to point to the tools, and you are set.

Or just use Visual C++ Express.


Following the previous comments I've installed Studio Express & VS2010. This did not solve the "cl.exe not in path" problem.

I solved the problem with the error Cannot find compiler cl.exe in path, by including c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 in PATH, before installing Windows SDK.

This question also contains valuable information.
For some reason VS2010 & Studio Express failed to set the proper variables in path even after the execution of vsvars32.bat.

Thank you all for your valuable help.


add this options to nvcc

nvcc x.cu <other options>  -ccbin "D:\Program Files\Microsoft Visual Studio 11.0\VC\bin"

i use VS2012 and my cl.exe dir is here.