I am working on Visual Studio 2008, using CUDA 5.0. I am using CUDA Runtime API as a build rule.
I am trying to compile a single test.cu file that contains a main function and one global kernel. Both the main function and the kernel contain external library function calls which I have compiled using the same CUDA environment, with relocatable device code flag enabled, and NVCC compilation type as -c.
The test.cu compiles well, but during linking it outputs the following error:
1>Linking...
1>test.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterLinkedBinary_43_tmpxft_00001888_00000000_8_test_cpp1_ii_98e63e3a referenced in function "void __cdecl __sti____cudaRegisterAll_43_tmpxft_00001888_00000000_8_test_cpp1_ii_98e63e3a(void)" (?__sti____cudaRegisterAll_43_tmpxft_00001888_00000000_8_test_cpp1_ii_98e63e3a@@YAXXZ)
I searched for __cudaRegisterLinkedBinary and found out that it is defined in crt/host_rintime.h in CUDA v5.0, but there is no such thing in v4.2.
crt/host_runtime.h:#define __REGISTERFUNCNAME_CORE(X) __cudaRegisterLinkedBinary##X
crt/host_runtime.h:#define ____cudaRegisterLinkedBinary(X)
So I suspect it might be related to separate compilation feature that was added with v5.0, am I correct?
Could anyone help me in resolving the error? If it is a problem due to separate compilation of .cu files, then does it mean that I have to put all kernels in one single .cu file to solve it?