title: Problems linking to an object file created with cuda nvcc
body: <p>I am trying to link to an object file generated by NVCC. Here a very simple "library":</p>
  
  <pre><code>//foo.cu:
  void foo() {
  }
  </code></pre>
  
  <p>And the file that uses the "library":</p>
  
  <pre><code>//main.cu:
  extern void foo();
  
  int main(){
  foo();
  }
  </code></pre>
  
  <p>Note, I circumvent the need for a include file in this simple setup by declaring the function directly in the file. Here the command I tried to build this:</p>
  
  <pre><code>nvcc -c foo.cu -arch=sm_20
  nvcc main.cu foo.o -arch=sm_20
  </code></pre>
  
  <p>Why is this not working with NVCC? The second command produces tons of:</p>
  
  <pre><code>warning: null character(s) ignored
  error: unrecognized token
  </code></pre>
  
  <p>I tried on a different machine with a different CUDA installation (4.0). Same strange compiler/linker output.</p>
  
  <p>I also tried using <code>extern "C"</code> instead of the C++ name mangling. Same behavior. Besides, C name mangling is not an option in the real application.</p>