VS2008 + separate compilation + C++ integration

Dear all,

I want to use dynamic parallelism (i.e. calling a kernel from within a kernel) in an existing Visual Studio 2008 project. This project contains .cu source files as well as C++ source files, and so far (before experimenting with dynamic parallelism) everything compiled and ran all right.

However, adding the device CUDA kernel invocations caused the compiler to stop with an error (somthing like “not supported with this compilation mode”). I added the option -dc to enable separate compilation.

However, now my project fails to link with the following error:

1>Linking...
1>.\x64\Release\cuVolumeTools.cu.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2ED2

This is most probably caused by visual studio trying to link CUDA object files with the standard C++ linker.

I guess that I have to instruct visual studio to somehow use nvcc for linking the .cu.obj files, but I am not sure how to do this. Can someone help me figure out how to make the link step work?

Hi,

What build of the CUDA toolkit are you using?
Where are you adding the (-dc) option? Did you use the drop down in the settings in the project or add it to the command line?