You declared cuda_function() as extern "C" , but then defined it with C ++. Remove extern "C" from your delcaration and it will work.
Alternatively, but pointless, you can add the same declaration to the cuda.cu file.
To develop a bit, nvcc is a shell that breaks a file into host code and device code, and then calls the host compiler and device compiler, respectively. Back in the old days of CUDA programming, nvcc called the host compiler in "C" mode wihch, which meant that you had to put extern "C" in delcarations when called from C ++. Returning to the current time, nvcc by default uses C ++ for the host code, which means that you no longer need these externs (unless, of course, the rest of your host code is in C).
source share