Skip to content

Commit 2af5980

Browse files
authored
Merge pull request #5855 from MicrosoftDocs/main
3/28/2025 AM Publish
2 parents 983da65 + a2bce3a commit 2af5980

23 files changed

+344
-338
lines changed
Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,53 @@
11
---
2-
description: "Learn more about: creating and configuring Visual Studio C++ projects"
3-
title: "Visual Studio Projects - C++"
4-
ms.date: 10/4/2023
2+
title: "Create and Configure Visual Studio C++ Projects"
3+
description: "Learn how to create a Visual Studio C++ project, and then add code and build your project."
4+
ms.date: 03/24/2025
5+
ms.topic: concept-article
56
helpviewer_keywords: ["Visual Studio C++ projects, creating", "projects [C++], creating", "Visual Studio C++ projects"]
67
---
7-
# Visual Studio projects - C++
8+
# Visual Studio C++ projects
89

9-
A *Visual Studio project* is a collection of code files and assets such as icons, images, and so on, that are built together using the MSBuild build system. MSBuild is the native build system for Visual Studio and is generally the best build system to use for Windows-specific programs. MSBuild is tightly integrated with Visual Studio, but you can also use it from the command line.
10+
A *Visual Studio project* is a collection of code files and assets such as icons, images, and so on, that are built together using the MSBuild system. MSBuild is the native build system for Visual Studio and is generally the best build system to use for Windows-specific programs. MSBuild is tightly integrated with Visual Studio, but you can also use it from the command line.
1011

11-
For information about upgrading MSBuild projects from older versions of Visual Studio, see the [Microsoft C++ Porting and Upgrading Guide](../porting/visual-cpp-porting-and-upgrading-guide.md).
12+
For information about upgrading MSBuild projects from older versions of Visual Studio, see the [Microsoft C++ porting and upgrading guide](../porting/visual-cpp-porting-and-upgrading-guide.md).
1213

13-
For cross-platform projects, or projects that use open-source libraries, we recommend using [CMake projects in Visual Studio](cmake-projects-in-visual-studio.md) in Visual Studio 2017 and later.
14+
For cross-platform projects, or projects that use open-source libraries, we recommend using [CMake projects in Visual Studio](cmake-projects-in-visual-studio.md).
1415

1516
## Create a Visual Studio C++ project
1617

1718
::: moniker range=">=msvc-160"
1819

1920
1. Create a C++ project by choosing **File** > **New** > **Project**.
21+
2022
1. In the **Create a new project** dialog, set the **Language** dropdown to **C++**. This filters the list of project templates to C++ projects. You can filter the templates by setting the **Platform**, **Project Type**, or by entering keywords in the search box.
2123

22-
![Screenshot of the Create a new project wizard. The Console App project template is selected.](../build/media/vs2019-choose-console-app.png)
24+
:::image type="content" source="../build/media/vs2019-choose-console-app.png" alt-text="Screenshot of the Create a new project wizard. The Console App project template is selected.":::
2325

2426
1. Select a project template, then choose **Next**.
27+
2528
1. On the **Configure your new project page**, enter project-specific settings such as the project name or location and then choose **Create** to create your project.
2629

2730
::: moniker-end
2831

2932
::: moniker range="msvc-150"
3033

3134
1. Create a C++ project by choosing **File** > **New** > **Project**.
35+
3236
1. Choose **Visual C++** in the left pane. In the center pane, a list of project templates appears:
3337

34-
![Screenshot of the New Project dialog, showing available project templates for C++ such as Windows Console Application.](../overview/media/vs2017-new-project.png "Visual Studio 2017 New Project Dialog")
38+
:::image type="content" source="../overview/media/vs2017-new-project.png" alt-text="Screenshot of the New Project dialog, showing available project templates for C++ such as Windows Console Application.":::
3539

3640
::: moniker-end
3741

3842
For more information about the default project templates included in Visual Studio, see [C++ project templates in Visual Studio](reference/visual-cpp-project-types.md).
3943

40-
You can create your own project templates. For more information, see [How to: Create project templates](/visualstudio/ide/how-to-create-project-templates).
44+
You can create your own project templates. For more information, see [Create project templates](/visualstudio/ide/how-to-create-project-templates).
4145

4246
After you create a project, it appears in the [Solution Explorer](/visualstudio/ide/solutions-and-projects-in-visual-studio) window:
4347

44-
![Screenshot of the Solution Explorer window, showing source files, header files, and resource files.](media/mathlibrary-solution-explorer-153.png)
48+
:::image type="content" source="media/mathlibrary-solution-explorer-153.png" alt-text="Screenshot of the Solution Explorer window, showing source files, header files, and resource files.":::
4549

46-
When you create a new project, a solution file (.sln) is also created. A *Visual Studio solution* is a collection of one or more projects. You can add another project to the solution by right-clicking the solution name in **Solution Explorer** > **Add** > **New project**.
50+
When you create a new project, a solution file (*`.sln`*) is also created. A *Visual Studio solution* is a collection of one or more projects. You can add another project to the solution by right-clicking the solution name in **Solution Explorer** > **Add** > **New project**.
4751

4852
The solution file coordinates build dependencies when you have multiple related projects. Compiler options are set at the project level.
4953

@@ -61,28 +65,28 @@ For more information about consuming a library that you have downloaded by using
6165
- [vcpkg in MSBuild projects](/vcpkg/users/buildsystems/msbuild-integration)
6266
- [Tutorial: Install and use packages with MSBuild in Visual Studio](/vcpkg/get_started/get-started-msbuild)
6367

64-
They're also commercial third-party libraries that you can install. Follow their installation instructions.
68+
There are also commercial third-party libraries that you can install. Follow their installation instructions.
6569

6670
## Set compiler options and build properties
6771

68-
To configure build settings for a project, right-click on the project in **Solution Explorer** and choose **Properties**. For more information, see [Set C++ compiler and build properties in Visual Studio](working-with-project-properties.md).
72+
To configure build settings for a project, right-click on the project in **Solution Explorer** and choose **Properties**. For more information, see [Set compiler and build properties](working-with-project-properties.md).
6973

7074
## Compile and run a project
7175

72-
To compile and run the new project, press **F5** or click the *debug dropdown* with the green arrow on the main toolbar. The *configuration dropdown* is where you choose whether to perform a *Debug* or *Release* build (or some other custom configuration).
76+
To compile and run the new project, press **F5** or select the *debug dropdown* with the green arrow on the main toolbar. The *configuration dropdown* is where you choose whether to perform a *Debug* or *Release* build (or some other custom configuration).
7377

7478
A new project compiles without errors. When adding your own code, you might occasionally introduce an error or trigger a warning. An error prevents the build from completing; a warning doesn't. All errors and warnings appear both in the Output Window and in the Error List when you build the project.
7579

76-
![Screenshot of the Output window and Error list, showing a syntax error for a misplaced colon.](../overview/media/vs2017-output-error-list.png)
80+
:::image type="content" source="../overview/media/vs2017-output-error-list.png" alt-text="Screenshot of the Output window and Error list, showing a syntax error for a misplaced colon.":::
7781

7882
In the **Error List**, you can press **F1** on the highlighted error to go to its documentation topic.
7983

80-
## See also
84+
## Related content
8185

82-
[Create a project from existing code](how-to-create-a-cpp-project-from-existing-code.md)\
83-
[Set C++ compiler and build properties in Visual Studio](working-with-project-properties.md)\
84-
[Custom build steps and build events](understanding-custom-build-steps-and-build-events.md)\
85-
[Reference libraries and components at build time](adding-references-in-visual-cpp-projects.md)\
86-
[Organize project output files](how-to-organize-project-output-files-for-builds.md)\
87-
[Projects and build systems](projects-and-build-systems-cpp.md)\
88-
[Microsoft C++ porting and upgrade guide](../porting/visual-cpp-porting-and-upgrading-guide.md)
86+
- [Create a project from existing code](how-to-create-a-cpp-project-from-existing-code.md)
87+
- [Set C++ compiler and build properties in Visual Studio](working-with-project-properties.md)
88+
- [Custom build steps and build events](understanding-custom-build-steps-and-build-events.md)
89+
- [Reference libraries and components at build time](adding-references-in-visual-cpp-projects.md)
90+
- [Organize project output files](how-to-organize-project-output-files-for-builds.md)
91+
- [Projects and build systems](projects-and-build-systems-cpp.md)
92+
- [Microsoft C++ porting and upgrade guide](../porting/visual-cpp-porting-and-upgrading-guide.md)

docs/build/creating-precompiled-header-files.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ This table lists compiler options that might trigger an inconsistency warning wh
140140

141141
| Option | Name | Rule |
142142
|--|--|--|
143-
| **`/D `**| Define constants and macros | Must be the same between the compilation that created the precompiled header and the current compilation. The state of defined constants isn't checked. However, unpredictable results can occur if your files depend on the values of the changed constants. |
143+
| **`/D`**| Define constants and macros | Must be the same between the compilation that created the precompiled header and the current compilation. The state of defined constants isn't checked. However, unpredictable results can occur if your files depend on the values of the changed constants. |
144144
| **`/E`** or **`/EP`** | Copy preprocessor output to standard output | Precompiled headers don't work with the **`/E`** or **`/EP`** option. |
145145
| **`/Fr`** or **`/FR`** | Generate Microsoft Source Browser information | For the **`/Fr`** and **`/FR`** options to be valid with the **`/Yu`** option, they must also have been in effect when the precompiled header was created. Subsequent compilations that use the precompiled header also generate Source Browser information. Browser information is placed in a single *`.sbr`* file and is referenced by other files in the same manner as CodeView information. You can't override the placement of Source Browser information. |
146146
| **`/GA`**, **`/GD`**, **`/GE`**, **`/Gw`**, or **`/GW`** | Windows protocol options | Must be the same between the compilation that created the precompiled header and the current compilation. The compiler emits a warning if these options differ. |
@@ -161,7 +161,6 @@ The code base of a software project is often contained in multiple C or C++ sour
161161

162162
The figure uses three diagrammatic devices to show the flow of the build process. Named rectangles represent each file or macro; the three macros represent one or more files. Shaded areas represent each compile or link action. Arrows show which files and macros are combined during the compilation or linking process.
163163

164-
![ The diagram is described in the text following the diagram.]()\
165164
Structure of a makefile that uses a precompiled header file:
166165

167166
:::image type="complex" source="media/vc30ow1.gif" alt-text="Diagram showing example inputs and outputs of a makefile that uses a precompiled header file.":::
15.6 KB
Loading
Loading
Loading

docs/build/reference/md-mt-ld-use-run-time-library.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2+
title: "/MD, /MT, /LD (Use runtime library)"
23
description: "Learn more about: /MD, /MT, /LD (Use runtime library)"
3-
title: "/MD, -MT, -LD (Use runtime library)"
44
ms.date: "01/13/2025"
55
f1_keywords: ["/ld", "/mt", "VC.Project.VCCLWCECompilerTool.RuntimeLibrary", "VC.Project.VCCLCompilerTool.RuntimeLibrary", "/md", "/ml"]
66
helpviewer_keywords: ["/MT compiler option [C++]", "-MD compiler option [C++]", "threading [C++], multithread compiler option", "MSVCRTD.lib", "MSVCRT.lib", "LIBCMT.lib", "MD compiler option [C++]", "/MD compiler option [C++]", "MT compiler option [C++]", "LD compiler option [C++]", "MDd compiler option [C++]", "-MDd compiler option [C++]", "LIBCD.lib", "-MTd compiler option [C++]", "MTd compiler option [C++]", "/MTd compiler option [C++]", "-LD compiler option [C++]", "/MDd compiler option [C++]", "multithread compiler option", "_STATIC_CPPLIB symbol", "LIBC.lib", "/LD compiler option [C++]", "DLLs [C++], compiler options", "LIBCMTD.lib", "-MT compiler option [C++]"]

docs/build/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ items:
99
- name: Set C++ compiler and build properties in Visual Studio
1010
expanded: false
1111
items:
12-
- name: Set C++ compiler and build properties in Visual Studio
12+
- name: Set C++ compiler and build properties
1313
href: ../build/working-with-project-properties.md
1414
- name: Share or reuse Visual Studio project settings
1515
href: ../build/create-reusable-property-configurations.md

0 commit comments

Comments
 (0)