Skip to content

Commit 2d6ddca

Browse files
Merge pull request #4770 from MicrosoftDocs/main638330755003939252sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 43f4eda + 9562ec9 commit 2d6ddca

15 files changed

+191
-82
lines changed

docs/build/creating-and-managing-visual-cpp-projects.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
---
22
description: "Learn more about: creating and configuring Visual Studio C++ projects"
33
title: "Visual Studio Projects - C++"
4-
ms.date: 04/20/2022
4+
ms.date: 10/4/2023
55
helpviewer_keywords: ["Visual Studio C++ projects, creating", "projects [C++], creating", "Visual Studio C++ projects"]
66
---
77
# Visual Studio projects - C++
88

99
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.
1010

11-
1211
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).
1312

1413
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.
1514

16-
1715
## Create a Visual Studio C++ project
1816

1917
::: moniker range=">=msvc-160"
@@ -53,13 +51,11 @@ The solution file coordinates build dependencies when you have multiple related
5351

5452
Add source code files, icons, or any other items to your project by right-clicking on the project in **Solution Explorer** and choosing **Add > New** or **Add > Existing**.
5553

56-
5754
## Add third-party libraries to a project
5855

5956
Over 900 C++ open source libraries are available via the [vcpkg](https://vcpkg.io/) package manager. Run the Visual Studio integration step to set up the paths to that library when you reference it from any Visual Studio project.
6057

61-
62-
There are also commercial third-party libraries that you can install. Follow their installation instructions.
58+
They're also commercial third-party libraries that you can install. Follow their installation instructions.
6359

6460
## Set compiler options and build properties
6561

@@ -69,11 +65,9 @@ To configure build settings for a project, right-click on the project in **Solut
6965

7066
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).
7167

68+
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.
7269

73-
A new project compiles without errors. When adding your own code, you may 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.
74-
75-
76-
![Screenshot of the Output window and Error list.](../overview/media/vs2017-output-error-list.png)
70+
![Screenshot of the Output window and Error list, showing a syntax error for a misplaced colon.](../overview/media/vs2017-output-error-list.png)
7771

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

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,12 @@ 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-
![Diagram showing example inputs and outputs of a makefile that uses a precompiled header file.](media/vc30ow1.gif)\
165-
Structure of a makefile that uses a precompiled header file
164+
![ The diagram is described in the text following the diagram.]()\
165+
Structure of a makefile that uses a precompiled header file:
166+
167+
:::image type="complex" source="media/vc30ow1.gif" alt-text="Diagram showing example inputs and outputs of a makefile that uses a precompiled header file.":::
168+
The diagram shows `$(STABLEHDRS)` and `$(BOUNDRY)` feeding into CL /c /W3 /Yc$(BOUNDRY) applib.cpp myapp.cpp. The output of that is $(STABLE.PCH). Then, applib.cpp and $(UNSTABLEHDRS) and $(STABLE.PCH) feed into CL /c /w3 /Yu $(BOUNDRY) applib.cpp, which produces applib.obj. myapp.cpp, $(UNSTABLEHDR), and $(STABLE.PCH) feed into CL /c /w3 /Yu $(BOUNDRY) myapp.cpp, which produces myapp.obj. Finally, applib.obj and myapp.obj are combined by LINK /NOD ONERROR:NOEXE $(OBJS), myapp, NUL, $(LIBS), NUL to produce myapp.exe.
169+
:::image-end:::
166170

167171
Beginning at the top of the diagram, both `STABLEHDRS` and `BOUNDRY` are NMAKE macros in which you list files not likely to need recompilation. These files are compiled by the command string
168172

docs/build/customize-cmake-settings.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ If you maintain projects that use a *`CMakeSettings.json`* file for CMake build
1414

1515
To open the CMake settings editor, select the **Configuration** drop-down in the main toolbar and choose **Manage Configurations**.
1616

17-
![Screenshot of the CMake configuration drop-down that highlights the Manage Configurations selection.](media/vs2019-cmake-manage-configurations.png)
17+
![Screenshot of the CMake configuration drop-down. Manage Configurations is highlighted.](media/vs2019-cmake-manage-configurations.png)
1818

1919
Now you see the **Settings Editor** with the installed configurations on the left.
2020

21-
![Screenshot of the CMake settings editor.](media/cmake-settings-editor.png)
21+
:::image type="complex" source="media/cmake-settings-editor.png" alt-text="Screenshot of the CMake settings editor.":::
22+
The left pane shows the installed configurations (x86-Debug). The right pane shows the settings for the selected configuration. The settings include the configuration name, configuration type (set to Debug), toolset (set to msvc_x86), CMake toolchain file (empty), build root (contains ${env:USERPROFILE}\CMakeBuilds\${workspaceHash}\build\${name}), CMake command arguments (empty), and build command arguments (-v).
23+
:::image-end:::
2224

2325
Visual Studio provides one `x64-Debug` configuration by default. You can add more configurations by choosing the green plus sign. The settings that you see in the editor might vary depending on which configuration is selected.
2426

@@ -34,7 +36,7 @@ Corresponds to the **name** setting. This name appears in the C++ configuration
3436

3537
### Configuration type
3638

37-
Corresponds to the **configurationType** setting. Defines the build configuration type for the selected generator. Currently supported values are "Debug", "MinSizeRel", "Release", and "RelWithDebInfo". It maps to [`CMAKE_BUILD_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html).
39+
Corresponds to the **configurationType** setting. Defines the build configuration type for the selected generator. Currently supported values are Debug, MinSizeRel, Release, and RelWithDebInfo. It maps to [`CMAKE_BUILD_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html).
3840

3941
### Toolset
4042

@@ -96,7 +98,7 @@ Corresponds to **generator**. Maps to the CMake **`-G`** switch, and specifies t
9698
- "Visual Studio 14 2015 Win64"
9799
- "Visual Studio 14 2015 ARM"
98100

99-
Because Ninja is designed for fast build speeds instead of flexibility and function, it's set as the default. However, some CMake projects may be unable to correctly build using Ninja. If that occurs, you can instruct CMake to generate a Visual Studio project instead.
101+
Because Ninja is designed for fast build speeds instead of flexibility and function, it's set as the default. However, some CMake projects might be unable to correctly build using Ninja. If that occurs, you can instruct CMake to generate a Visual Studio project instead.
100102

101103
### IntelliSense mode
102104

@@ -190,8 +192,10 @@ You can also directly edit *`CMakeSettings.json`* to create custom configuration
190192

191193
JSON IntelliSense helps you edit the *`CMakeSettings.json`* file:
192194

193-
![Screenshot of the CMake JSON IntelliSense pop-up in the editor.](media/cmake-json-intellisense.png "CMake JSON IntelliSense")
194-
195+
:::image type="complex" source="media/cmake-json-intellisense.png" alt-text="Screenshot of the CMake JSON IntelliSense pop-up in the editor.":::
196+
The JSON IntelliSense pop-up for "configurations" shows buildCommandArgs, buildRoot, cmakeCommandArgs, configurationType, among several others.
197+
:::image-end:::
198+
195199
For more information about each of the properties in the file, see [`CMakeSettings.json` schema reference](cmakesettings-reference.md).
196200

197201
::: moniker-end

0 commit comments

Comments
 (0)