title: CUDA 5.0 error LNK2001: unresolved external symbol for cuda methods
body: <p>I have error in linker</p>
  
  <pre><code>1&gt;ManifestResourceCompile:
  1&gt;  All outputs are up-to-date.
  1&gt;kernel.cu.obj : error LNK2001: unresolved external symbol _cudaMalloc@8
  1&gt;kernel.cu.obj : error LNK2001: unresolved external symbol _cudaFree@4
  </code></pre>
  
  <p>I saw similar question added here :
  <a href="https://stackoverflow.com/questions/2061715/unresolved-external-symbols-in-beginners-cuda-program">Unresolved external symbols in beginners CUDA program</a>
  But it's already have added this information to linker.</p>
  
  <p>So where is the problem ?
  I'm using Visual Studio 2010 Premium with CUDA SDK 5.0 and Nsight 3.0 for VS</p>
  
  <p>Source code here : <a href="http://pastebin.com/DfdfSfWd" rel="nofollow noreferrer">http://pastebin.com/DfdfSfWd</a>
  (It's a example generated by Visual Studio on created new project for CUDA 5.0)</p>
  
  <p>[EDIT]</p>
  
  <p>Settings for Linker</p>
  
  <blockquote>
    <p>Configuration Properties->Linker->General->Additional Library Directories :</p>
    
    <p>$(CudaToolkitLibDir) $(CUDA_LIB_PATH) $(CUDA_PATH)\lib\$(PlatformName) </p>
    
    <p>Configuration Properties->Linker->Input->Additional Dependencies </p>
    
    <p>cuda.lib;cudart.lib; and the other libs.. </p>
  </blockquote>
  
  <p>But in properties I see that CUDA haves own Linder, "CUDA Linker" and that doesnt have set</p>
  
  <blockquote>
    <p>Additional Library Directories</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>Additional Dependencies</p>
  </blockquote>
  
  <p>so I set this properties but nothing that change, the linker still have problem.</p>
  
  <p>[EDIT]</p>
  
  <p>Ok, the error is when I change</p>
  
  <blockquote>
    <p>Configuration Properties->CUDA C/C++->Device->Code Generation</p>
  </blockquote>
  
  <p>from</p>
  
  <blockquote>
    <p>compute_10,sm_10</p>
  </blockquote>
  
  <p>to</p>
  
  <blockquote>
    <p>compute_20,sm_20</p>
  </blockquote>
  
  <p>and add a flag -dc for CUDA C/C++</p>