How to Enable Syntax Highlighting for CUDA files in Visual Studio 2005?
It’s really awkward if the CUDA file displayed as a normal file in Visual Studio. It’s essentially following C style format. But the keywords are different from C/C++. But Visual Studio is flexible enough to give editor experience for a custom file.
So what you’ve to do to enable syntax highlighting for CUDA Source files? It’s clearly described in the CUDA SDK help files.
1. Setup CUDA in your box. (Install the CUDA SDK and CUDA Toolkit)
2. Browse to “Microsoft Visual Studio 8\Common7\IDE” folder from your program files folder
3. Open the user “usertype.dat” file from the folder. If the file doesn’t exists, create a new one in the name.
4. Open the %Program Files%\NVIDIA Corporation\NVIDIA CUDA SDK\doc\syntax_highlighting\visual_studio_8
5. Append the content of “usertype.dat” to the previously opened “usertype.dat” file from “Microsoft Visual Studio 8\Common7\IDE”
6. Save the file
7. Open You IDE and Take Tools -> Options.
8. Under Text Editor -> File Extension tab, specify the extension “cu” as a new type (as pictured below)
1. Restart your IDE
2. Enjoy Syntax highlighting
Note that the above settings are applicable for Visual Studio 8 only. For Visual Studio 7 the setup is slightly different. You can see the instruction from NVIDIA Corporation\NVIDIA CUDA SDK\doc\syntax_highlighting\visual_studio_7 folder once you install the CUDA SDK.

about 1 year ago
It was very helpful.
Thanks
about 1 year ago
Note that this enables syntax highlighting (which is really nice), but it doesn’t enable IntelliSense for .cu files.
about 1 year ago
That’s correct Fooble. But do you know how to enable IntelliSense so it can support Cuda functions, variables, etc??
about 1 year ago
Just to let you know, this also works on Visual Studio 2008 which is supported from CUDA 2.1 beta onwards.
about 1 year ago
It doesn’t Quite work for VS2008 -
All the c highlighting works fine – from the .cu file association However CUDA keywords are still not highlighted…
__global__
__host__
__device__
__constant__
__shared__
about 1 year ago
HOW DO Keyword highlight in visual c++ 6.0????
BACKGROUND TEXT
OR
SET COLOR(X,Y)
visual c++ 6.0
visual c++ 6.0
visual c++ 6.0
visual c++ 6.0
PLEAS HELP ME
INTERMANCH@GMAIL.COM
about 1 year ago
Thank you! Really useful! It works for Visual Studio 2005!
about 10 months ago
Syntax Highlighting worked for the VS 2008 as well.
Thank you!
about 9 months ago
Thank you for the post.
Worked pretty fine.
about 9 months ago
Thanks very much
about 7 months ago
Thanks! This is really great!
about 2 months ago
Thank you so much!
This really helped me out…