kernel multiple definitions/linking problem simple code will compile but won't link

I have a simple program for solving the heat equaition. It consists of a host code, a kernel and a header heat.h. I try to compile and link using

nvcc -o run

and I get the following error message:

/tmp/tmpxft_00004991_00000000-24_heat_kernel.o: In function __device_stub__Z10heatevolvePiPf': tmpxft_00004991_00000000-23_heat_kernel.ii:(.text+0x6b9e): multiple definition of __device_stub__Z10heatevolvePiPf’
/tmp/tmpxft_00004991_00000000-15_heat.o:tmpxft_00004991_00000000-14_heat.ii:(.text+0x6b9e): first defined here
collect2: ld returned 1 exit status

It seems like its compiling OK but the linking is failing. I have no idea what this error message means. Anybody have any ideas?

Is your setup copied and pasted from one of the NVIDIA samples that would put “#include <>” at the top of That would explay the multiply defined symbol.

That did it - Thanks!

Hi guys:
I have the same problem.
And yes, I copied and pasted nvidia setup, and put “” at the top of “”
You said that that was the problem.

So, how did you solve it?
Did you erase that line (that didn’t work for me)? Or did you do something else?

Your help is appreciated,


Hi Daniel,

I encountered this issue myself. I don’t know if you’re still in need of a solution for this problem, but you can find a solution here:

Hope this helps,