CUDA Link2005 error.

I meet the this error when compile CUDA.

error LNK2005: "int __cdecl XXXX" (?XXXXX@@YAHXZ) already defined in XXX.cu.obj

I solved error from the web page. -> http://stackoverflow.com/questions/5295503/cuda-lnk2005-error-on-device-function-used-in-header-file

In my case, I add "inline" keyword front of cuda function name.
 __device__ void matrix_set_identity(GPU_Matrix *A)


inline  __device__ void matrix_set_identity(GPU_Matrix *A)

Thank you.

No comments:

Post a Comment