something wrong with my kernel_func

I used the “VS2005 Project Wizard for CUDA” to create a new project

I also enable the emulation of " ok.cu " & " ok_kernel.cu "

when I compile the program…compile error happened… >.<

====================================================
ok_kernel.obj : error LNK2005: __Z13render_kerneliiid already defined in ok.obj

ok_kernel.obj : error LNK2005: ___device_stub__Z13render_kerneliiid already defined in ok.obj

1>…/…/bin/win32/EmuRelease/ok.exe : fatal error LNK1169: one or more multiply defined symbols found

===================================================

Does anyone know how to solve it ? :thumbup:
Thanks~~~!

I think it’s easiest to think of your kernels as analogous to (defined-where-declared) static/inline functions in C/C++, and the files that define them as headers. Therefore, it is incorrect to try to compile a header file (even if the compiler generates object code without errors). Your linker is complaining because ok.obj declares symbols with the same name as ones in ok_kernel.obj. That’s because you included ok_kernel.cu in the source of ok.cu.

You should only #include your *.kernel.cu and never include them as build targets. Search the forums, someone has included specific instructions for fixing Visual Studio projects that are incorrectly configured like this.