Export (0) Print
Expand All

Tools for Visual C++ Development

As part of the Visual Studio Integrated Development Environment (IDE), Visual C++ shares many windows and tools in common with other languages. Many of those, including Solution Explorer, the Code Editor, and the Debugger, are documented in the MSDN library under Application Development in Visual Studio. Often, a shared tool or window has a slightly different set of features for C++ than for the .NET languages or Javascript. Some windows or tools are only available in Visual Studio Pro or Visual Studio Ultimate. This topic introduces the Visual Studio IDE from the perspective of Visual C++, and provides links to other topics relevant to Visual C++.

In addition to shared tools in the Visual Studio IDE, Visual C++ has several tools specifically for native code development. These tools are also listed in this article. For a list of which tools are available in each edition of Visual Studio, see Visual C++ Tools and Templates in Visual Studio Editions.

In all editions of Visual C++, you organize the source code and related files for an executable ( such as an .exe, .dll or .lib) into a project. A project has a project file in XML format (.vcxproj) that specifies all the files and resources needed to compile the program, as well as other configuration settings, for example the target platform (x86, x64 or ARM) and whether you are building a release version or debug version of the program. A project (or many projects) are contained in a Solution; for example, a solution might contain several Win32 DLL projects, and a single Win32 console application that uses those DLLs. For general information about projects, see Managing Solutions, Projects, and Files.

Project templates

Visual C++ comes with several project templates, which contain starter code and the settings needed for a variety of basic program types. Typically you start by choosing File | New Project to create a project from a project template, then add new source code files to that project, and/or start coding in the files provided. For information specific to C++ projects and project wizards, see Creating and Managing Visual C++ Projects.

Application wizards

Visual C++ provides wizards for some project types. A wizard guides you step-by-step through the process of creating a new project. For more information, see Creating Desktop Projects By Using Application Wizards.

If your program has a user interface, one of the first tasks is to populate it with controls such as buttons, list boxes and so on. Visual Studio Pro and above includes a visual design surface and a toolbox for each flavor of C++ application. Visual Studio Express includes tools for Windows Stores. No matter which type of app you are creating, the basic idea is the same: you drag a control from the toolbox window and drop it onto the design surface at the desired location. In the background, Visual Studio generates the resources and code required to make it all work.

For more information about creating a user interface for a Windows Store, see _____.

For more information about creating a user interface for an MFC application, see MFC Desktop Applications. For information about Win32 Windows programs, see Win32 Windows Applications (C++).

For information about Windows Forms applications with C++/CLI, see Creating a Windows Forms Application By Using the .NET Framework (C++).

Semantic colorization

After you create a project, all the project files are displayed in the Solution Explorer window. When you click on a .h or .cpp file in Solution Explorer, the file opens up in the code editor. The code editor is a specialized word processor for C++ source code. It color-codes language keywords, method and variable names, and other elements of your code to make the code more readable and easier to understand.

Intellisense

The code editor also supports several features that together are known as Intellisense. You can hover over a method and see some basic documentation for it. After you type a class variable name and a . or ->, a list of instance members of that class appears. If you type a class name and then a ::, a list of static members appears. When you start typing a class or method name, the code editor will offer suggestions to complete the statement. For more information, see Using IntelliSense.

Code snippets

You can use Intellisense code snippets to generate commonly-used or complicated code constructs with a shortcut keystroke. For more information, see Code Snippets.

The VIEW menu provides access to many windows and tools for navigating around in your code files. For detailed information about these windows, see Viewing the Structure of Code.

Solution Explorer

In all editions of Visual Studio, use the Solution Explorer pane to navigate between the files in a project. Expand a .h or .cpp file icon to view the classes in the file. Expand a class to see its members. Double-click on a member to navigate to its definition or implementation in the file.

Class View and Code Definition Window

Use the Class View pane to see the namespaces and classes across all the files, including partial classes. You can expand each namespace or class to see its members and double-click on the member to navigate to that location in the source file. If you open the Code Definition Window, you can view the definition or implementation of the type when you choose it in Class View.

Object Browser

Use Object Browser to explore type information in Windows Runtime components (.winmd files), .NET assemblies and COM type libraries. It is not used with Win32 DLLs.

Go To Definition/Declaration

Press F12 on any API name or member variable to go to its definition. If the definition is in a .winmd file (for a Windows Store app) then you will be shown the type info in the Object Browser. You can also Go To Definition or Go To Declaration by right-clicking on the variable or type name and choosing the option from the context menu.

Find All References

In a source code file, right-click with the mouse cursor over the name of a type or method or variable, and choose Find all References to return a list of every location in the file, project or solution where the type is used. Find All References is intelligent and only returns instances of the same identical variable, even if other variables at different scope have the same name.

Architecture Explorer and Dependency Graphs (Ultimate)

Use Architecture Explorer to view relationships between various elements in your code. For more information, see Find Code with Architecture Explorer. Use dependency graphs to view dependency relationships. For more information, see How to: Generate Dependency Graphs for C and C++ Code.

The term "resource" in the context of a Visual Studio desktop project includes things such as dialog boxes, icons, localizable strings, spash screens, database connection strings, or any arbitrary data that you want to include in the executable file. Visual Studio.

For more information on adding and editing resources in native desktop C++ projects, see Working with Resource Files. For more information about resources in a Windows Store, see,

Press Ctrl + Shift + B to compile and link a project. Visual Studio uses MSBuild to create executable code. You can set many build options under Tools | Options | Projects and Solutions. Build errors and warnings are reported in the Error List (Ctrl +\, E). Additional information is sometimes shown in the Output Window (Alt + 2). For more information, see Building C++ Projects in Visual Studio.

You can also use the Visual C++ compiler (cl.exe) and many other build-related standalone tools such as NMAKE and LIB directly from the command line. For more information, see Building on the Command Line and C/C++ Building Reference.

Visual Studio includes a unit test framework for both native C++ and C++/CLI. For more information, see Verifying Code by Using Unit Tests and Writing Unit tests for C/C++ with the Microsoft Unit Testing Framework for C++

You can debug your program by pressing F5 when your project configuration is set to Debug. While debugging you can set breakpoints by pressing F9, step through code by pressing F10, view the values of specified variables or registers, and even in some cases make changes in code and continue debugging without re-compiling. For more information, see Debugging in Visual Studio.

You deploy a Windows Store to customers through the Windows Store through the PROJECT | Store menu option. Deployment of the CRT is handled automatically behind the scenes. For more information, see Selling Apps.

When you deploy a native C++ desktop application to another computer, you must install the application itself and any library files that the application depends on. Visual C++ in Visual Studio 2012 gives you three ways to deploy the Visual C++ runtime with an application: central deployment, local deployment, or static linking. For more information, see Deploying Native Desktop Applications (Visual C++).

For more information about deploying a C++/CLI program, see .NET Framework Deployment Guide for Developers,

Visual C++ Tools and Templates in Visual Studio Editions

Shows which features are available in the various editions of Visual Studio.

Visual C++ Guided Tour

Provides an overview of the Visual Studio development environment and the kinds of C++ apps that you can create.

Creating and Managing Visual C++ Projects

Provides an overview of C++ projects in Visual Studio and links to other articles that explain how to create and manage them.

Building C/C++ Programs

Describes how to build C++ projects.

Deploying Native Desktop Applications (Visual C++)

Provides an overview of deployment for C++ apps and links to other articles that describe deployment in detail.

Porting and Upgrading Programs

Links to articles that describe how to open C++ apps that were created in earlier versions of Visual Studio, and also how to open apps that were created by using tools other than Visual Studio.

Visual C++

Describes key features of Visual C++ in Visual Studio and links to the rest of the Visual C++ documentation.

Show:
© 2014 Microsoft