Browse Multiple Source Code Files in Visual Studio

As and when C++ programs become big and more and more code is written in a single file, developers distribute code into C++ classes and often every class file has a .h file and a .cpp file. The .h file contains the class or function declarations and the .cpp file contains function implementation. This sample code displays an example of a C++ Console Application containing multiple file. The Solution Explorer can be used to browse through various files of the project as displayed in the screenshot below.

Sample C++ Console Application Distributed in Multiple Files

Sample C++ Console Application Distributed in Multiple Files

As and when the C++ files become bloated with code, it can be difficult to find function, variable or other stuff in a single file. In order to help software developers easily find what they are looking for, Visual Studio provides code browsing functionality which can be invoked from keyboard shortcut or right click menu as displayed in the screenshot below.

Right Click Menu in Code Editor of Visual Studio

Right Click Menu in Code Editor of Visual Studio

In order to navigate to the definition of a function (wherever available), declaration of member variable or any other c++ code, just right click on the appropriate code and select Go to Definition as displayed in the screenshot above. You can alternatively use the F12 function key to quickly navigate to any other file of your project. C++ Developers often work with other Software Libraries in which case they do not have source code, however at-least the corresponding header file is provided in such case and most of the times documentation of the Software Development Kit is provided as well.

The Solution Explorer provided in Visual C++ is also easy to understand and browse for projects having multiple files in the project. In order to find out relevant features of your Visual C++ Installation, just remember that Menu Bar & Toolbar of the Visual Studio does enumerates all the functionality provided and right click menu provides quick and easy way to use the most relevant functionality whether you are writing C++ Code, doing debugging for your code or finding memory leaks.