cudalogo2 Just would like to give small tips I found to help working with CUDA under visual studio.

First, syntax highlighting for .cu files can be enabled with these few steps:

  1. Copy the content of the “usertype.dat” file provided by nvidia (NVIDIA CUDA SDK\doc\syntax_highlighting\visual_studio_8) into your “Microsoft Visual Studio 8\Common7\IDE” folder from your program files folder.

  2. Open Visual Studio and Take Tools -> Options. Under Text Editor -> File Extension tab, specify the extension “cu” as a new type.

Visual Studio rely on a feature named Intellisense to provide functions and variables names completion, definitions lookup and all these kind of features. To get intelligence working with .cu files, yo have to modify a windows registry key: Add c and cuh extensions to NCB Default C/C++ Extensions key under “HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Languages\Language Services\C/C++” path. (Thanks to for the tip)

For those using Visual Assist X, you can do the following. First, find the Visual Assist X install directory: (X:\Program Files\Visual
Assist X\AutoText\latest) and then make a copy of Cpp.tpl and rename it
to Cu.tpl. Second, Open and close Visual Studio (this initializes
Visual Assist X parameters by creating some folders/variables in the
Registry ). Third, open regedit and go to: “HKEY_CURRENT_USER\Software\Whole Tomato\Visual Assist X\VANet9″ and add “.cu;” to the ExtSource key and add “.cuh;” to the ExtHeader key. (Thanks to ciberxtrem for the tip)

Finally, build rules allowing to easily compile .cu files without having to write the rules manually can be integrated installing this little wizard: More details on CUDA build rules can be found on this website :