The Visual C++ code editor and IDE provide many coding aids. Some are unique to C++, and some are essentially the same for all Visual Studio languages. For more information about the shared features, see Writing Code in the Code and Text Editor. Options for enabling and configuring C++-specific features are located in the Text Editor C++ Advanced dialog (Tools | Options | Text Editor | C/C++ | Advanced or type "C++ Advanced" in Quick Launch). After choosing which option you want to set, you can get more help by pressing F1 when the dialog is in focus. For general code formatting options, type Editor C++ into QuickLaunch.
Experimental features, which may or may not be included in a future version of Visual Studio, are found in the Text Editor C++ Experimental dialog. In Visual Studio 2017 you can enable Predictive Intellisense in this dialog.
Adding new code
After creating a project, you can start coding in the files that were generated for you. To add new files, right-click on the project node in Solution Explorer and choose Add | New.
To set formatting options such as indents, brace completion, and colorization, type C++ Formatting into the QuickLaunch window.
IntelliSense
IntelliSense is the name for a set of features that provide inline information about members, types, and function overloads. The following illustration shows the member list drop-down that appears as you type. You can press the tab key to enter the selected item text into your code file.
For complete information see Visual C++ Intellisense.
Insert Snippets
A snippet is a predefined piece of source code. Right-click on a single point or on selected text to either insert a snippet or surround the selected text with the snippet. The following illustration shows the three steps to surround a selected statement with a for loop. The yellow highlights in the final image are editable fields that you access with the tab key. For more information, see Code Snippets.
Add Class
Add a new class from the Project menu by using the Class Wizard.
Class Wizard
Modify or examine an existing class, or add a new class, using the Class Wizard. For more information, see Adding Functionality with Code Wizards (C++).
Refactoring
Refactorings are available under the Quick Action context menu, or by clicking on a light bulb in the editor. Some are also found in the Edit > Refactor menu. These features include:
- Rename
- Extract Function
- Implement Pure Virtuals
- Create Declaration / Definition
- Move Function Definition
- Convert to Raw String Literal
- Change Signature
Navigate and understand
Visual C++ shares many code navigation features with other languages. For more information,see
QuickInfo
Hover over a variable to see its type information.
Open document (Navigate to header)
Right click on the header name in an #include directive and open the header file.
Peek Definition
Hover over a variable or function declaration, right-click, then choose Peek Definition to see an inline view of its definition. For more information, see Peek Definition (Alt+F12).
Go To Definition
Hover over a variable or function declaration, right-click, then choose Go To Definition to open the document where the object is defined.
View Call Hierarchy
Right click on any function call and view a resursive list of all the functions that it calls, and all the functions that call it. Each function in the list can be expanded in the same way. For more information, see Call Hierarchy.
Toggle Header / Code File
Right-click and choose Toggle Header / Code File to switch back and forth between a header file and its associated code file.
Outlining
Right-click anywhere in a source code file and choose Outlining to collapse or expand definitions and/or custom regions to make it easier to browse only the parts you are interested in. For more information, see Outlining.
Scroll bar map mode
Scrollbar map mode enables you to quickly scroll and browse through a code file without actually leaving your current location. Or click anywhere on the code map to go directly to that location.
Generate graph of include files
Right click on a code file in your project and choose Generate graph of include files to see a graph of which files are included by other files.
F1 Help
Place the cursor on or just after any type, keyword or function and press F1 to go directly to the relevant MSDN reference topic. F1 also works on items in the error list, and in many dialog boxes.
Quick Launch
To easily navigate to any window or tool in Visual Studio, simply type its name in the Quick Launch window in the upper right corner of the UI. The auto-completion list will filter as you type.





