title: linking error: unresolved external symbol ___cudaRegisterLinkedBinary referenced in function ____cudaRegisterAll
body: <p>I am working on Visual Studio 2008, using CUDA 5.0. I am using CUDA Runtime API as a build rule.<br>
  I am trying to compile a single test.cu file that contains a main function and one <strong>global</strong> kernel. Both the main function and the kernel contain external library function calls which I have compiled using the same CUDA environment, with relocatable device code flag enabled, and NVCC compilation type as -c. 
  The test.cu compiles well, but during linking it outputs the following error:</p>
  
  <pre><code>1&gt;Linking...
  1&gt;test.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterLinkedBinary_43_tmpxft_00001888_00000000_8_test_cpp1_ii_98e63e3a referenced in function "void __cdecl __sti____cudaRegisterAll_43_tmpxft_00001888_00000000_8_test_cpp1_ii_98e63e3a(void)" (?__sti____cudaRegisterAll_43_tmpxft_00001888_00000000_8_test_cpp1_ii_98e63e3a@@YAXXZ)
  </code></pre>
  
  <p>I searched for __cudaRegisterLinkedBinary and found out that it is defined in crt/host_rintime.h in CUDA v5.0, but there is no such thing in v4.2. </p>
  
  <pre><code>crt/host_runtime.h:#define __REGISTERFUNCNAME_CORE(X) __cudaRegisterLinkedBinary##X 
  crt/host_runtime.h:#define ____cudaRegisterLinkedBinary(X)
  </code></pre>
  
  <p>So I suspect it might be related to separate compilation feature that was added with v5.0, am I correct? </p>
  
  <p>Could anyone help me in resolving the error? 
  If it is a problem due to separate compilation of .cu files, then does it mean that I have to put all kernels in one single .cu file to solve it? </p>