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.
