CUDA SDK 2.1 Visual Studio Build Rule Fix

All,

in case you get compile errors with .cu files that are not in the main directory of your application (i.e. in a subfolder), please note that the CUDA build rule that comes with the 2.1 SDK needs a fix:

  • Right Click on your project
  • Click Custom Build Rules…
  • Select the SDK build rule (if you’ve already added it)
  • Click Modify Rule File
  • Select the .cu line and click Modify Build Rule…

In the “Command Line” entry, look for the end of the first and second lines, which reads (InputFileName). Replace with "(InputDir)$(InputFileName)". Don’t forget the quotes, or paths with a space will give you an error.

I hope this will help somebody waste less time than I did…

Christian

You could also try using the CUDA VS Wizard