When you type a symbol known to Visual Assist but not within the current file, Visual Assist can insert a directive in your current file to make the symbol known.
Using Directive in C#
Reference a common .NET type, and Visual Assist suggests adding the appropriate using directive. Accept the suggestion and Visual Assist inserts the directive near the top of the current file, without changing the position of the text caret.
Visual Assist suggests directives if it is configured—in the options dialog of Visual Assist—to display listboxes for C#.
Hover over an undeclared identifier and choose "Add include" from a refactoring menu (Shift+Alt+Q) to insert the appropriate directive. The directive is inserted after the last #include in your current file, outside of any #ifdef directives. The position of the text caret is unchanged.
Note: Except for a few system libraries such as MFC and CRT, Visual Assist can only suggest to include headers if it has parsed them. If "Add include" is missing from, or disabled in, a refactoring menu, add the appropriate directory(ies) to your project settings, and manually include the directory somewhere in your project or solution. Once included in one location, Visual Assist can suggest to include the header in other locations.
Umbrella Headers in C/C++
In most cases, Visual Assist adds the specific header that contains the definition of a symbol, not an umbrella header that includes it and other related headers. There are a few exceptions for several popular libraries, including Boost and Qt. In these cases, Visual Assist adds the umbrella header.
Note: Except for a few system libraries such as MFC and CRT, Visual Assist can only suggest to include headers if it has parsed them, including the headers for Boost and Qt. Headers for Boost or Qt should be listed in the VC++ Directories of your project, so they are considered stable, and included somewhere in a solution. Once included in one location, Visual Assist can suggest to include the headers in other locations.
Add Include Style in C/C++
Visual Assist determines which format of #include is appropriate:
You can force Visual Assist to use your preferred style in the options dialog of Visual Assist.
You can select a style and optionally, restrict the directive to include only filenames, i.e. omit file paths.
Visual Assist inserts an include directive whose path delimiter, '/' or '\', is identical to the delimiter of existing #include directives in the file. If the current file contains no #include directives, or none of them use a path delimiter, then Visual Assist uses the default delimiter specified in the IDE or registry.
Needless #includes in C/C++
Add Include makes the addition of headers convenient. You should rely on compiler errors, and your knowledge of header hierarchy, to decide if a #include is required.
Be mindful not to add headers needlessly. Visual Assist lets you add the header that contains the definition of a symbol, even if you have already included an umbrella header.