title: Compiling for Compute Capability 2.x in CUDA C for VS2010
body: <p>I was following this: <a href="https://stackoverflow.com/questions/6937693/dynamically-allocating-memory-inside-device-global-cuda-kernel">Dynamically allocating memory inside __device/global__ CUDA kernel</a></p>
  
  <p>But it still doesn't compile.</p>
  
  <pre><code>error : calling a host function("_malloc_dbg") from a __device__/__global__  
  function("kernel") is not allowed
  
  error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA  
  \v4.1\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\"  
  --use-local-env --cl-version 2010 -ccbin "c:\Program Files (x86)\Microsoft Visual  
  Studio 10.0\VC\bin\x86_amd64" -I"..\..\..\Source\Include" -G0  --keep-dir   
  "x64\Debug" -maxrregcount=0  --machine 64 --compile  -g  -Xcompiler "/EHsc /nologo 
  /Od /Zi  /MDd " -o "x64\Debug\move.cu.obj"  "C:\Source\scene\move.cu"" exited with  
  code 2. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA  
  4.1.targets     361 10  
  </code></pre>
  
  <p>As suggested, I added <code>#if __CUDA_ARCH__ &gt;= 200</code> and it returns false.</p>
  
  <p>What else can be the issues? I'm running on a GTX480.</p>
  
  <p>Edit: I have this warning as well: <code>#warning C4005: '_malloca' : macro redefinition</code></p>