Skip to content

Commit 54b1f4e

Browse files
authored
Merge pull request #3209 from TylerMSFT/twhitney-build
first draft
2 parents dc37321 + 4c177c7 commit 54b1f4e

8 files changed

+64
-52
lines changed
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: "C/C++ projects and build systems in Visual Studio"
3-
ms.description: "Use Visual Studio to compile and build C++ projects for Windows, ARM or Linux based on any project system."
3+
description: "Use Visual Studio to compile and build C++ projects for Windows, ARM, or Linux based on any project system."
44
ms.date: "07/17/2019"
55
helpviewer_keywords: ["builds [C++]", "C++ projects, building", "projects [C++], building", "builds [C++], options", "C++, build options"]
66
ms.assetid: fa6ed4ff-334a-4d99-b5e2-a1f83d2b3008
77
ms.topic: "overview"
88
---
99
# C/C++ projects and build systems in Visual Studio
1010

11-
You can use Visual Studio to edit, compile and build any C++ code base with full IntelliSense support without having to convert that code into a Visual Studio project or compile with the MSVC toolset. For example, you can edit a cross-platform CMake project in Visual Studio on a Windows machine, then compile it for Linux using g++ on a remote Linux machine.
11+
You can use Visual Studio to edit, compile, and build any C++ code base with full IntelliSense support without having to convert that code into a Visual Studio project or compile with the MSVC toolset. For example, you can edit a cross-platform CMake project in Visual Studio on a Windows machine, then compile it for Linux using g++ on a remote Linux machine.
1212

1313
## C++ compilation
1414

@@ -22,25 +22,25 @@ Basic C++ compilation involves three main steps:
2222

2323
## The MSVC toolset
2424

25-
The Microsoft C++ compiler, linker, standard libraries, and related utilities comprise the MSVC compiler toolset (also called a toolchain or "build tools"). These are included in Visual Studio. You can also download and use the toolset as a standalone package for free from the [Build Tools for Visual Studio 2019 download location](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019).
25+
The Microsoft C++ compiler, linker, standard libraries, and related utilities make up the MSVC compiler toolset (also called a toolchain or "build tools"). These are included in Visual Studio. You can also download and use the toolset as a free standalone package from [Build Tools for Visual Studio 2019 download](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019).
2626

2727
You can build simple programs by invoking the MSVC compiler (cl.exe) directly from the command line. The following command accepts a single source code file, and invokes cl.exe to build an executable called *hello.exe*:
2828

2929
```cmd
3030
cl /EHsc hello.cpp
3131
```
3232

33-
Note that here the compiler (cl.exe) automatically invokes the C++ preprocessor and the linker to produce the final output file. For more information, see [Building on the command line](building-on-the-command-line.md).
33+
Here the compiler (cl.exe) automatically invokes the C++ preprocessor and the linker to produce the final output file. For more information, see [Building on the command line](building-on-the-command-line.md).
3434

3535
## Build systems and projects
3636

37-
Most real-world programs use some kind of *build system* to manage complexities of compiling multiple source files for multiple configurations (i.e. debug vs. release), multiple platforms (x86, x64, ARM, and so on), custom build steps, and even multiple executables that must be compiled in a certain order. You make settings in a build configuration file(s), and the build system accepts that file as input before it invoke the compiler. The set of source code files and build configuration files needed to build an executable file is called a *project*.
37+
Most real-world programs use some kind of *build system* to manage complexities of compiling multiple source files for multiple configurations (debug vs. release), multiple platforms (x86, x64, ARM, and so on), custom build steps, and even multiple executables that must be compiled in a certain order. You make settings in a build configuration file(s), and the build system accepts that file as input before it invoke the compiler. The set of source code files and build configuration files needed to build an executable file is called a *project*.
3838

3939
The following list shows various options for Visual Studio Projects - C++:
4040

4141
- create a Visual Studio project by using the Visual Studio IDE and configure it by using property pages. Visual Studio projects produce programs that run on Windows. For an overview, see [Compiling and Building](/visualstudio/ide/compiling-and-building-in-visual-studio) in the Visual Studio documentation.
4242

43-
- open a folder that contains a CMakeLists.txt file. CMake support is integrated into Visual Studio. You can use the IDE to edit, test and debug without modifying the CMake files in any way. This enables you to work in the same CMake project as others who might be using different editors. CMake is the recommended approach for cross-platform development. For more information, see [CMake projects](cmake-projects-in-visual-studio.md).
43+
- open a folder that contains a CMakeLists.txt file. CMake support is integrated into Visual Studio. You can use the IDE to edit, test, and debug without modifying the CMake files in any way. This enables you to work in the same CMake project as others who might be using different editors. CMake is the recommended approach for cross-platform development. For more information, see [CMake projects](cmake-projects-in-visual-studio.md).
4444

4545
- open a loose folder of source files with no project file. Visual Studio will use heuristics to build the files. This is an easy way to compile and run small console applications. For more information, see [Open Folder projects](open-folder-projects-cpp.md).
4646

@@ -50,45 +50,45 @@ The following list shows various options for Visual Studio Projects - C++:
5050

5151
## MSBuild from the command line
5252

53-
You can invoke MSBuild from the command line by passing it a .vcxproj file along with command-line options. This approach requires a good understanding of MSBuild, and is recommended only when absolutely necessary. For more information, see [MSBuild](msbuild-visual-cpp.md).
53+
You can invoke MSBuild from the command line by passing it a .vcxproj file along with command-line options. This approach requires a good understanding of MSBuild, and is recommended only when necessary. For more information, see [MSBuild](msbuild-visual-cpp.md).
5454

5555
## In This Section
5656

57-
[Visual Studio projects](creating-and-managing-visual-cpp-projects.md)
57+
[Visual Studio projects](creating-and-managing-visual-cpp-projects.md)\
5858
How to create, configure, and build C++ projects in Visual Studio using its native build system (MSBuild).
5959

60-
[CMake projects](cmake-projects-in-visual-studio.md)
60+
[CMake projects](cmake-projects-in-visual-studio.md)\
6161
How to code, build, and deploy CMake projects in Visual Studio.
6262

63-
[Open Folder projects](open-folder-projects-cpp.md)
64-
How to use Visual Studio to code, build and deploy C++ projects based on any arbitrary build system, or no build system. at all.
63+
[Open Folder projects](open-folder-projects-cpp.md)\
64+
How to use Visual Studio to code, build, and deploy C++ projects based on any arbitrary build system, or no build system at all.
6565

66-
[Release builds](release-builds.md)
66+
[Release builds](release-builds.md)\
6767
How to create and troubleshoot optimized release builds for deployment to end users.
6868

69-
[Use the MSVC toolset from the command line](building-on-the-command-line.md)<br/>
69+
[Use the MSVC toolset from the command line](building-on-the-command-line.md)\
7070
Discusses how to use the C/C++ compiler and build tools directly from the command line rather than using the Visual Studio IDE.
7171

72-
[Building DLLs in Visual Studio](dlls-in-visual-cpp.md)
73-
How to create, debug and deploy C/C++ DLLs (shared libraries) in Visual Studio.
72+
[Building DLLs in Visual Studio](dlls-in-visual-cpp.md)\
73+
How to create, debug, and deploy C/C++ DLLs (shared libraries) in Visual Studio.
7474

75-
[Walkthrough: Creating and Using a Static Library](walkthrough-creating-and-using-a-static-library-cpp.md)
76-
How to create a .lib binary file.
75+
[Walkthrough: Creating and Using a Static Library](walkthrough-creating-and-using-a-static-library-cpp.md)\
76+
How to create a **.lib** binary file.
7777

78-
[Building C/C++ Isolated Applications and Side-by-side Assemblies](building-c-cpp-isolated-applications-and-side-by-side-assemblies.md)
78+
[Building C/C++ Isolated Applications and Side-by-side Assemblies](building-c-cpp-isolated-applications-and-side-by-side-assemblies.md)\
7979
Describes the deployment model for Windows Desktop applications, based on the idea of isolated applications and side-by-side assemblies.
8080

81-
[Configure C++ projects for 64-bit, x64 targets](configuring-programs-for-64-bit-visual-cpp.md)
81+
[Configure C++ projects for 64-bit, x64 targets](configuring-programs-for-64-bit-visual-cpp.md)\
8282
How to target 64-bit x64 hardware with the MSVC build tools.
8383

84-
[Configure C++ projects for ARM processors](configuring-programs-for-arm-processors-visual-cpp.md)
84+
[Configure C++ projects for ARM processors](configuring-programs-for-arm-processors-visual-cpp.md)\
8585
How to use the MSVC build tools to target ARM hardware.
8686

87-
[Optimizing Your Code](optimizing-your-code.md)
87+
[Optimizing Your Code](optimizing-your-code.md)\
8888
How to optimize your code in various ways including program guided optimizations.
8989

90-
[Configuring Programs for Windows XP](configuring-programs-for-windows-xp.md)
90+
[Configuring Programs for Windows XP](configuring-programs-for-windows-xp.md)\
9191
How to target Windows XP with the MSVC build tools.
9292

93-
[C/C++ Building Reference](reference/c-cpp-building-reference.md)<br/>
93+
[C/C++ Building Reference](reference/c-cpp-building-reference.md)\
9494
Provides links to reference articles about program building in C++, compiler and linker options, and various build tools.

docs/linux/configure-a-linux-project.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Configure a Linux MSBuild C++ project in Visual Studio"
3-
ms.date: "08/06/2020"
3+
ms.date: "10/16/2020"
44
description: "Configure a MSBuild-based Linux project in Visual Studio so you can build it."
55
ms.assetid: 4d7c6adf-54b9-4b23-bd23-5de0c825b768
66
---
@@ -20,7 +20,7 @@ You can configure a Linux project to target a physical Linux machine, a virtual
2020

2121
**Visual Studio 2019 version 16.1**:
2222

23-
- When targeting WSL, you can avoid the copy operations that are necessary for building and IntelliSense when targeting remote Linux systems.
23+
- When you target WSL, you can avoid the copy operations needed to build and get IntelliSense that are required when you target a remote Linux system.
2424

2525
- You can specify separate Linux targets for building and debugging.
2626

@@ -34,6 +34,10 @@ To view configuration options, select the **Project > Properties** menu, or righ
3434

3535
By default, an executable (.out) is built. To build a static or dynamic library, or to use an existing Makefile, use the **Configuration Type** setting.
3636

37+
If you're building for Windows Subsystem for Linux (WSL), WSL Version 1 is limited to 64 parallel compilation processes. This is governed by the **Max Parallel Compilation Jobs** setting in **Configuration properties > C/C++ > General**.
38+
39+
Regardless of the WSL version you are using, if you intend to use more than 64 parallel compilation processes, we recommend that you build with Ninja--which generally will be faster and more reliable. To build with Ninja, use the **Enable Incremental Build** setting in **Configuration properties > General**.
40+
3741
For more information about the settings in the property pages, see [Linux Project Property Page Reference](prop-pages-linux.md).
3842

3943
## Remote settings
@@ -46,7 +50,7 @@ To change settings related to the remote Linux computer, configure the remote se
4650

4751
::: moniker range="vs-2019"
4852

49-
**Visual Studio 2019 version 16.1**: To target Windows Subsystem for Linux, click the down arrow for **Platform Toolset** and choose **WSL_1_0**. The other remote options will disappear and the path to the default WSL shell will appear in their place:
53+
**Visual Studio 2019 version 16.7**: To target Windows Subsystem for Linux (WSL), set the **Platform Toolset** drop-down to **GCC for Windows Subsystem for Linux**. The other remote options will disappear and the path to the default WSL shell will appear in their place:
5054

5155
![WSL build machine](media/wsl-remote-vs2019.png)
5256

@@ -61,7 +65,7 @@ To change settings related to the remote Linux computer, configure the remote se
6165
- The **Remote Build Project Directory** is where this specific project will be built on the remote Linux computer. This will default to **$(RemoteRootDir)/$(ProjectName)**, which will expand to a directory named after the current project, under the root directory set above.
6266

6367
> [!NOTE]
64-
> To change the default C and C++ compilers, or the Linker and Archiver used to build the project, use the appropriate entries in the **C/C++ > General** section and the **Linker > General** section. You can specify a certain version of GCC or Clang, for example. For more information see [C/C++ Properties (Linux C++)](prop-pages/c-cpp-linux.md) and [Linker Properties (Linux C++)](prop-pages/linker-linux.md).
68+
> To change the default C and C++ compilers, or the Linker and Archiver used to build the project, use the appropriate entries in the **C/C++ > General** section and the **Linker > General** section. You can specify a certain version of GCC or Clang, for example. For more information, see [C/C++ Properties (Linux C++)](prop-pages/c-cpp-linux.md) and [Linker Properties (Linux C++)](prop-pages/linker-linux.md).
6569
6670
## Copy sources (remote systems only)
6771

@@ -100,7 +104,7 @@ This functionality depends on the Linux machine having zip installed. You can in
100104
sudo apt install zip
101105
```
102106

103-
To manage your header cache, navigate to **Tools > Options, Cross Platform > Connection Manager > Remote Headers IntelliSense Manager**. To update the header cache after making changes on your Linux machine, select the remote connection and then select **Update**. Select **Delete** to remove the headers without deleting the connection itself. Select **Explore** to open the local directory in **File Explorer**. Treat this folder as read-only. To download headers for an existing connection that was created prior to Visual Studio 2017 version 15.3, select the connection and then select **Download**.
107+
To manage your header cache, navigate to **Tools > Options, Cross Platform > Connection Manager > Remote Headers IntelliSense Manager**. To update the header cache after making changes on your Linux machine, select the remote connection and then select **Update**. Select **Delete** to remove the headers without deleting the connection itself. Select **Explore** to open the local directory in **File Explorer**. Treat this folder as read-only. To download headers for an existing connection that was created before Visual Studio 2017 version 15.3, select the connection and then select **Download**.
104108

105109
::: moniker range="vs-2017"
106110

0 commit comments

Comments
 (0)