title: Cuda 4.0 with Visual Studio 2010 cl compiler error
body: <p>As I did not get any help in the <a href="http://forums.nvidia.com/index.php?s=694d90b48a2678063a619d0ed138f76d&amp;showtopic=207820" rel="nofollow">Nvidia forums</a> (see my post at the bottom of the thread), and it seems I am not the only one struggeling with similar problems, I will give it a try here.</p>
  
  <p>I tried to compile the Cuda SDK 4.0 examples as well as following the very nice <a href="http://www.ademiller.com/blogs/tech/2011/05/visual-studio-2010-and-cuda-easier-with-rc2/" rel="nofollow">tutorial by Ade Miller</a>. But compiling the ".cu" file won't work.</p>
  
  <p>This is the (exemplary) command the compiler invokes:</p>
  
  <pre><code>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" 
  -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env 
  --cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC bin\x86_amd64"  
  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include"  -G0  
  --keep-dir "x64\Debug" -maxrregcount=0  --machine 64 --compile  -D_NEXUS_DEBUG 
  -g    -Xcompiler "/EHsc /nologo /Od /Zi  /MDd " -o "x64\Debug\Hello.cu.obj" 
  "D:\Code\CUDA\Test_Cuda_4_0\Test_Cuda_4_0\Hello.cu" 
  </code></pre>
  
  <p>And this is the strange error message I always get.</p>
  
  <pre><code>nvcc fatal   : Compiler 'cl' in PATH different than the one specified with -ccbin
  </code></pre>
  
  <p><strong>EDIT</strong>: To be a bit more precise: Visual Studio just tells me the command did not succeed ("exit code -1") -> to see this error message I have to invoke the command by myself in the command line.</p>
  
  <p>1) Why should <code>nvcc</code> care about the path in the environment variable differing from the one specified with the command line option? If it would care, wouldn't this make the command line option completely useless?</p>
  
  <p>2) How to fix ;) ?</p>
  
  <p>I use Win7 64Bit, VS2010 Prof SP1, and the following nvidia versions:
  cudatoolkit_4.0.17_win_64
  devdriver_4.0_winvista-win7_64_270.81_general
  gpucomputingsdk_4.0.19_win_64</p>
  
  <p>Many thanks for your help!</p>