device-link.obj / cudaRegisterLinkedBinary error

I’m looking at simpleSeparateCompilation_vs2008.sln, which is part of the CUDA 5.0 samples package. The solution built successfully on the first try. I then made a slight modification (added whitespace) to simplieSeparateCompliation.cu and attempted to build the solution again. This resulted in a build error:

1>simpleSeparateCompilation.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterLinkedBinary_72_tmpxft_00001348_00000000_14_simpleSeparateCompilation_compute_35_cpp1_ii_e3db9f73 referenced in function “void __cdecl __sti____cudaRegisterAll_72_tmpxft_00001348_00000000_14_simpleSeparateCompilation_compute_35_cpp1_ii_e3db9f73(void)” (?__sti____cudaRegisterAll_72_tmpxft_00001348_00000000_14_simpleSeparateCompilation_compute_35_cpp1_ii_e3db9f73@@YAXXZ)

I’ve discovered two ways of getting around the error:

  1. Do a clean build / rebuild
  2. Delete simpleSeparateCompilation.device-link.obj prior to doing a build

Has anyone else encountered this problem? Any tips for avoiding the error?

Thanks.

This comment has only to do with the following error message

unresolved external symbol ___cudaRegisterLinkedBinary

which I have encountered when linking a CUDA static library created by myself to a Visual Studio 2010 project. So it is not really related to the compilation of the simpleSeparateCompilation of the original poster. I have added a comment to the thread

https://devtalk.nvidia.com/default/topic/525616/question-about-___cudaregisterlinkedbinary-referenced-in-function-____cudaregisterall/?offset=3#3942819

to describe my experience. I hope this could help other users finding this thread when searching for the same error above.