You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/building-on-the-command-line.md
+15-9Lines changed: 15 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Use the Microsoft C++ toolset from the command line"
3
3
description: "Use the Microsoft C++ (MSVC) compiler toolset from the command line outside of the Visual Studio IDE."
4
4
ms.custom: "conceptual"
5
-
ms.date: 08/02/2021
5
+
ms.date: 09/08/2021
6
6
helpviewer_keywords: ["command-line builds [C++]", "compiling source code [C++], command line", "builds [C++], command-line", "command line [C++], building from", "command line [C++], compilers"]
7
7
ms.assetid: 7ca9daed-a003-4162-842d-908f79058365
8
8
---
@@ -246,20 +246,26 @@ Use the compiler (cl.exe) to compile and link source code files into apps, libra
246
246
[`Link`](reference/linking.md)<br/>
247
247
Use the linker (link.exe) to link compiled object files and libraries into apps and DLLs.
248
248
249
-
[`NMAKE`](reference/nmake-reference.md)<br/>
250
-
Use NMAKE (nmake.exe) on Windows to build C++ projects based on a traditional makefile.
251
-
252
249
When you build on the command line, the F1 command isn't available for instant help. Instead, you can use a search engine to get information about warnings, errors, and messages. You can also download and use the offline help files. To use the search in docs.microsoft.com, enter your query in the search box at the top of any article.
253
250
254
251
## Command-line project management tools
255
252
256
-
The Visual Studio IDE uses a native project build system based on MSBuild. You can invoke MSBuild directly, or use the native project system without using the IDE:
253
+
By default, the Visual Studio IDE uses native project build systems based on MSBuild. You can invoke MSBuild directly to build projects without using the IDE. You can also use the `devenv` command to use Visual Studio to build projects and solutions. Visual Studio also supports build systems based on CMake or NMake.
254
+
255
+
[`MSBuild`](msbuild-visual-cpp.md)\
256
+
Use MSBuild (msbuild.exe) and a project file (.vcxproj) to configure a build and invoke the toolset without loading the Visual Studio IDE. It's equivalent to running the **Build** project or **Build Solution** command in the Visual Studio IDE. MSBuild has advantages over the IDE when you build at the command line. You don't have to install the full IDE on all your build servers and build pipelines. You avoid the extra overhead of the IDE. MSBuild runs in containerized build environments, and supports a [binary logger](https://msbuildlog.com/).
Use DEVENV (devenv.exe) combined with a command-line switch such as **`/Build`** or **`/Clean`** to execute certain build commands without displaying the Visual Studio IDE.
257
260
258
-
[`MSBuild`](msbuild-visual-cpp.md)<br/>
259
-
Use MSBuild (msbuild.exe) and a project file (.vcxproj) to configure a build and invoke the toolset indirectly. It's equivalent to running the **Build** project or **Build Solution** command in the Visual Studio IDE. Running MSBuild from the command line is an advanced scenario and not commonly recommended. Starting in Visual Studio 2019 version 16.5, MSBuild doesn't use the command-line environment to control the toolset and libraries used.
CMake (cmake.exe) is a cross-platform, open-source tool for defining build processes that run on multiple platforms. CMake can configure and control native build tools for its supported platforms, such as MSBuild and Make. For more information about CMake, see the [CMake documentation](https://cmake.org/cmake/help/latest/index.html#).
Use DEVENV (devenv.exe) combined with a command-line switch such as **`/Build`** or **`/Clean`** to execute certain build commands without displaying the Visual Studio IDE. In general, DEVENV is preferred over using MSBuild directly, because you can let Visual Studio handle the complexities of MSBuild. Starting in Visual Studio 2019 version 16.5, DEVENV doesn't use the command-line environment to control the toolset and libraries used.
264
+
[`NMAKE`](reference/nmake-reference.md)\
265
+
Use NMAKE (nmake.exe) to build C++ projects by using a traditional makefile.
266
+
267
+
> [!NOTE]
268
+
> Starting in Visual Studio 2019 version 16.5, MSBuild and DEVENV don't use the command-line environment to control the toolset and libraries used.
Visual Studio supports multiple platform toolsets. That means it's possible to target operating systems and runtime libraries that aren't supported by the default toolset. For example, by switching the platform toolset, you can use the Visual Studio 2017 C++ compiler to create apps that target Windows XP and Windows Server 2003. You can also use older platform toolsets to maintain binary-compatible legacy code and still take advantage of the latest features of the Visual Studio IDE.
10
10
11
-
::: moniker range="msvc-160"
11
+
::: moniker range=">=msvc-160"
12
12
13
-
The v142 toolset supplied in Visual Studio 2019 doesn't include support for creating code for Windows XP. Support for Windows XP development by using the Visual Studio 2017 v141_xp toolset is available as an individual component option in the Visual Studio Installer.
13
+
The toolset supplied in Visual Studio 2019 and later doesn't include support for creating code for Windows XP. Support for Windows XP development is available by using the Visual Studio 2017 v141_xp toolset. You can install the v141_xp toolset as an individual component option in the Visual Studio Installer.
14
14
15
15
::: moniker-end
16
16
@@ -22,7 +22,7 @@ To get the Visual Studio 2017 platform toolset and components to target Windows
22
22
23
23
::: moniker-end
24
24
25
-
::: moniker range="msvc-160"
25
+
::: moniker range=">=msvc-160"
26
26
27
27
To get the v141_xp platform toolset and components to target Windows XP and Windows Server 2003, run the Visual Studio Installer. When you initially install Visual Studio, or when you modify an existing installation, make sure the **Desktop development with C++** workload is selected. In the **Individual components** tab, under **Compilers, build tools, and runtimes**, choose **C++ Windows XP Support for VS 2017 (v141) tools \[Deprecated]**, and then choose **Install** or **Modify**.
28
28
@@ -36,11 +36,23 @@ The Windows XP platform toolset that's included in Visual Studio is a version of
36
36
37
37
1. In **Solution Explorer**, open the shortcut menu for your project, and then choose **Properties**.
38
38
39
-
1. In the **Property Pages** dialog box for the project, select **Configuration Properties** > **General**. Set the **Platform Toolset** property to your preferred Windows XP toolset. For example, choose **Visual Studio 2017 - Windows XP (v141_xp)** to create code for Windows XP and Windows Server 2003 by using the Microsoft C++ compiler in Visual Studio 2017.
39
+
1. In the **Property Pages** dialog box for the project, set the **Configuration** dropdown to **All configurations**.
40
+
41
+
1. Select the **Configuration Properties** > **General** property page. Set the **Platform Toolset** property to your preferred Windows XP toolset. For example, choose **Visual Studio 2017 - Windows XP (v141_xp)** to create code for Windows XP and Windows Server 2003 by using the Microsoft C++ compiler from Visual Studio 2017.
40
42
41
43
### C++ runtime support
42
44
43
-
Along with the Windows XP platform toolset, several libraries include runtime support for Windows XP and Windows Server 2003. These libraries are: the C Runtime Library (CRT), C++ Standard Library, Active Template Library (ATL), Concurrency Runtime Library (ConCRT), Parallel Patterns Library (PPL), Microsoft Foundation Class Library (MFC), and C++ AMP (C++ Accelerated Massive Programming) library. For these operating systems, the minimum supported versions are: Windows XP Service Pack 3 (SP3) for x86, Windows XP Service Pack 2 (SP2) for x64, and Windows Server 2003 Service Pack 2 (SP2) for both x86 and x64.
45
+
Along with the Windows XP platform toolset, several libraries include runtime support for Windows XP and Windows Server 2003:
46
+
47
+
- Universal C Runtime Library (UCRT)
48
+
- C++ Standard Library
49
+
- Active Template Library (ATL)
50
+
- Concurrency Runtime Library (ConCRT)
51
+
- Parallel Patterns Library (PPL)
52
+
- Microsoft Foundation Class Library (MFC)
53
+
- C++ AMP (C++ Accelerated Massive Programming) library.
54
+
55
+
The minimum supported versions of these operating systems are: Windows XP Service Pack 3 (SP3) for x86, Windows XP Service Pack 2 (SP2) for x64, and Windows Server 2003 Service Pack 2 (SP2) for both x86 and x64.
44
56
45
57
These libraries are supported by the platform toolsets installed by Visual Studio, depending on the target:
46
58
@@ -58,24 +70,33 @@ These libraries are supported by the platform toolsets installed by Visual Studi
58
70
59
71
### Differences between the toolsets
60
72
61
-
Because of differences in platform and library support, the development experience for apps that use a Windows XP platform toolset isn't as complete as for apps that use the default Visual Studio platform toolset.
73
+
Because of differences in platform and library support, the development experience for apps that use a Windows XP platform toolset isn't as complete as for apps that use the default platform toolset.
62
74
63
75
-**C++ language features**
64
76
65
-
Only C++ language features implemented in Visual Studio 2012 are supported in apps that use the v110\_xp platform toolset. Only C++ language features implemented in Visual Studio 2013 are supported in apps that use the v120\_xp platform toolset. Only C++ language features implemented in Visual Studio 2015 are supported in apps that use the v140\_xp platform toolset. Only C++ language features implemented in Visual Studio 2017 are supported in apps that use the v141\_xp platform toolset. Visual Studio uses the corresponding compiler when it builds using the older platform toolsets. Use the most recent Windows XP platform toolset to take advantage of additional C++ language features implemented in that version of the compiler.
77
+
Only C++ language features implemented in Visual Studio 2017 are supported in apps that use the v141\_xp platform toolset. Only C++ language features implemented in Visual Studio 2015 are supported in apps that use the v140\_xp platform toolset. Visual Studio uses the corresponding compiler when it builds using the older platform toolsets. Use the most recent Windows XP platform toolset to take advantage of the latest C++ language features implemented in that version of the compiler. For more information about language feature support by compiler version, see [Microsoft C/C++ language conformance](../overview/visual-cpp-language-conformance.md).
66
78
67
79
-**Remote debugging**
68
80
69
-
Remote Tools for Visual Studio doesn't support remote debugging on Windows XP or Windows Server 2003. To debug an app locally or remotely on Windows XP or Windows Server 2003, use a debugger from an older version of Visual Studio. It's similar to debugging an app on Windows Vista, which is a runtime target of the platform toolset, but not a remote debugging target.
81
+
Remote debugging on Windows XP or Windows Server 2003 isn't supported by Remote Tools for Visual Studio. To debug an app locally or remotely on Windows XP or Windows Server 2003, use a debugger from an older version of Visual Studio. It's similar to debugging an app on Windows Vista: Vista is a *runtime* target of the platform toolset, but not a *remote debugging* target.
70
82
71
83
-**Static analysis**
72
84
73
-
The Windows XP platform toolsets don't support static analysis because the SAL annotations for the Windows 7 SDK and the runtime libraries are incompatible. You can still perform static analysis on an app that supports Windows XP or Windows Server 2003. Temporarily switch the solution to target the default platform toolset for the analysis, and then switch back to the Windows XP platform toolset to build the app.
85
+
The Windows XP platform toolsets don't support static analysis. The SAL annotations for the Windows 7 SDK and the runtime libraries are incompatible. You can still run static analysis on an app that supports Windows XP or Windows Server 2003. Temporarily switch the solution to target the default platform toolset for the analysis, and then switch back to the Windows XP platform toolset to build the app.
74
86
75
87
-**Debugging of DirectX graphics**
76
88
77
-
Because the Graphics Debugger doesn't support the Direct3D 9 API, it can't be used to debug apps that use Direct3D on Windows XP or Windows Server 2003. However, if the app implements an alternative renderer based on Direct3D 10 or Direct3D 11 APIs, you can use the Graphics Debugger to diagnose problems.
89
+
The Graphics Debugger doesn't support the Direct3D 9 API. It can't be used to debug apps that use Direct3D on Windows XP or Windows Server 2003. However, if the app implements an alternative renderer based on Direct3D 10 or Direct3D 11 APIs, you can use the Graphics Debugger to diagnose problems.
78
90
79
91
-**Building HLSL**
80
92
81
93
The Windows XP toolset doesn't compile HLSL source code files by default. To compile HLSL files, download and install the June 2010 DirectX SDK, and then set the project's VC directories to include it. For more information, see the "DirectX SDK Does Not Register Include/Library Paths with Visual Studio 2010" section of the [June 2010 DirectX SDK download page](https://web.archive.org/web/20161026183606/https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=6812) (Archived link).
94
+
95
+
## Windows XP deployment
96
+
97
+
> [!IMPORTANT]
98
+
> Because it lacks support for SHA-256 code signing certificates, runtime library support for Windows XP is no longer available in the [latest Visual C++ Redistributable](https://support.microsoft.com/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0) for Visual Studio 2015, 2017, and 2019. The last redistributable to support Windows XP is version 16.7 (file version 14.27.29114.0). If your Windows XP apps are deployed with or updated to a later version of the redistributable, the apps won't run.
99
+
100
+
If you're using a version of Visual Studio later than Visual Studio 2019 version 16.7, the redistributable files won't work on Windows XP. To get a copy of the redistributable files that support Windows XP, you'll need a Visual Studio account. Use the account you use to sign in to Visual Studio. Or, you can create an account for free at [my.visualstudio.com](https://my.visualstudio.com). The redistributable file is available in the Downloads section, as [Visual C++ Redistributable for Visual Studio 2019 - Version 16.7](https://my.visualstudio.com/Downloads?q=Redistributable%20for%20Visual%20Studio%202019%20Version%2016.7). To download the files, select the platform and language you need, and then choose the Download button.
101
+
102
+
You can use central deployment or local deployment to install runtime library support for your Windows XP app. For more information, see [Walkthrough: Deploying a Visual C++ Application By Using the Visual C++ Redistributable Package](../windows/deploying-visual-cpp-application-by-using-the-vcpp-redistributable-package.md).
Copy file name to clipboardExpand all lines: docs/cpp/welcome-back-to-cpp-modern-cpp.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
2
title: "Welcome back to C++ - Modern C++"
3
3
description: "Describes the new programming idioms in Modern C++ and their rationale."
4
-
ms.date: "05/17/2020"
4
+
ms.date: 09/07/2021
5
5
ms.topic: "conceptual"
6
6
ms.assetid: 1cb1b849-ed9c-4721-a972-fd8f3dab42e2
7
7
---
8
8
# Welcome back to C++ - Modern C++
9
9
10
-
Since its creation, C++ has become one of the most widely used programming languages in the world. Well-written C++ programs are fast and efficient. The language is more flexible than other languages: It can work at the highest levels of abstraction, and down at the level of the silicon. C++ supplies highly optimized standard libraries. It enables access to low-level hardware features, to maximize speed and minimize memory requirements. Using C++, you can create a wide range of apps. Games, device drivers, and high-performance scientific software. Embedded programs. Windows client apps. Even libraries and compilers for other programming languages get written in C++.
10
+
Since its creation, C++ has become one of the most widely used programming languages in the world. Well-written C++ programs are fast and efficient. The language is more flexible than other languages: It can work at the highest levels of abstraction, and down at the level of the silicon. C++ supplies highly optimized standard libraries. It enables access to low-level hardware features, to maximize speed and minimize memory requirements. C++can create almost any kind of program: Games, device drivers, HPC, cloud, desktop, embedded, and mobile apps, and much more. Even libraries and compilers for other programming languages get written in C++.
11
11
12
-
One of the original requirements for C++ was backward compatibility with the C language. As a result, C++ has always permitted C-style programming, with raw pointers, arrays, null-terminated character strings, and other features. They may enable great performance, but can also spawn bugs and complexity. The evolution of C++ has emphasized features that greatly reduce the need to use C-style idioms. The old C-programming facilities are there when you need them, but with modern C++ code you should need them less and less. Modern C++ code is simpler, safer, more elegant, and still as fast as ever.
12
+
One of the original requirements for C++ was backward compatibility with the C language. As a result, C++ has always permitted C-style programming, with raw pointers, arrays, null-terminated character strings, and other features. They may enable great performance, but can also spawn bugs and complexity. The evolution of C++ has emphasized features that greatly reduce the need to use C-style idioms. The old C-programming facilities are still there when you need them. However, in modern C++ code you should need them less and less. Modern C++ code is simpler, safer, more elegant, and still as fast as ever.
13
13
14
14
The following sections provide an overview of the main features of modern C++. Unless noted otherwise, the features listed here are available in C++11 and later. In the Microsoft C++ compiler, you can set the [`/std`](../build/reference/std-specify-language-standard-version.md) compiler option to specify which version of the standard to use for your project.
15
15
@@ -40,7 +40,7 @@ void functionUsingWidget() {
40
40
41
41
```
42
42
43
-
Whenever possible, use a smart pointer when allocating heap memory. If you must use the new and delete operators explicitly, follow the principle of RAII. For more information, see [Object lifetime and resource management (RAII)](object-lifetime-and-resource-management-modern-cpp.md).
43
+
Whenever possible, use a smart pointer to manage heap memory. If you must use the **`new`** and **`delete`** operators explicitly, follow the principle of RAII. For more information, see [Object lifetime and resource management (RAII)](object-lifetime-and-resource-management-modern-cpp.md).
44
44
45
45
## `std::string` and `std::string_view`
46
46
@@ -198,7 +198,7 @@ The lambda expression `[=](int i) { return i > x && i < y; }` can be read as "fu
198
198
199
199
## Exceptions
200
200
201
-
Modern C++ emphasizes exceptions rather than error codes as the best way to report and handle error conditions. For more information, see [Modern C++ best practices for exceptions and error handling](errors-and-exception-handling-modern-cpp.md).
201
+
Modern C++ emphasizes exceptions, not error codes, as the best way to report and handle error conditions. For more information, see [Modern C++ best practices for exceptions and error handling](errors-and-exception-handling-modern-cpp.md).
0 commit comments