We recommend using Visual Studio 2017

How to: Define Keywords in Visual C++


Keywords are predefined, reserved identifiers that have special meanings. They cannot be used as identifiers in a program. However, you can define your own keywords to use in Visual C++, and you can assign customized syntax coloring to the keywords. Syntax coloring gives you visual cues about the structure and state of your code.

To define your own Visual C++ keywords

  1. Use the Visual Studio Code and Text Editor or Notepad.exe to create a text-only file named usertype.dat.

  2. In usertype.dat, type each user-defined keyword on a separate line.

  3. Save usertype.dat in the directory that contains devenv.exe. By default, the path of that directory is <drive>:\Program Files\Microsoft Visual Studio <major.minor version number>\Common7\IDE. Because that directory is read-only by default, you need administrative credentials to save usertype.dat.

  4. Exit Visual Studio, and then restart it.


    You cannot rename or reload the usertype.dat file during an editing session because it is read during initialization. All previously defined color settings take precedence because the syntax coloring mechanism checks the usertype.dat file last.

  5. On the Tools menu, click Options. In the Options dialog box, click Environment, then click Fonts and Colors, and then in the Display items: list, click C/C++ User Keywords.

  6. Set the font and color properties of your user-defined keywords as described in Fonts and Colors, Environment, Options Dialog Box.

For more information, see Keywords (C++).