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
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
5
6
helpviewer_keywords: ["Visual Studio C++ projects, creating", "projects [C++], creating", "Visual Studio C++ projects"]
6
7
---
7
-
# Visual Studio projects - C++
8
+
# Visual Studio C++ projects
8
9
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.
10
11
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).
12
13
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).
14
15
15
16
## Create a Visual Studio C++ project
16
17
17
18
::: moniker range=">=msvc-160"
18
19
19
20
1. Create a C++ project by choosing **File** > **New** > **Project**.
21
+
20
22
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.
21
23
22
-

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.":::
23
25
24
26
1. Select a project template, then choose **Next**.
27
+
25
28
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.
26
29
27
30
::: moniker-end
28
31
29
32
::: moniker range="msvc-150"
30
33
31
34
1. Create a C++ project by choosing **File** > **New** > **Project**.
35
+
32
36
1. Choose **Visual C++** in the left pane. In the center pane, a list of project templates appears:
33
37
34
-

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.":::
35
39
36
40
::: moniker-end
37
41
38
42
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).
39
43
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).
41
45
42
46
After you create a project, it appears in the [Solution Explorer](/visualstudio/ide/solutions-and-projects-in-visual-studio) window:
43
47
44
-

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.":::
45
49
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**.
47
51
48
52
The solution file coordinates build dependencies when you have multiple related projects. Compiler options are set at the project level.
49
53
@@ -61,28 +65,28 @@ For more information about consuming a library that you have downloaded by using
61
65
-[vcpkg in MSBuild projects](/vcpkg/users/buildsystems/msbuild-integration)
62
66
-[Tutorial: Install and use packages with MSBuild in Visual Studio](/vcpkg/get_started/get-started-msbuild)
63
67
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.
65
69
66
70
## Set compiler options and build properties
67
71
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).
69
73
70
74
## Compile and run a project
71
75
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).
73
77
74
78
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.
75
79
76
-

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.":::
77
81
78
82
In the **Error List**, you can press **F1** on the highlighted error to go to its documentation topic.
79
83
80
-
## See also
84
+
## Related content
81
85
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)\
Copy file name to clipboardExpand all lines: docs/linux/download-install-and-setup-the-linux-development-workload.md
+19-20Lines changed: 19 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,15 @@
1
1
---
2
-
title: "Install the C++ Linux workload in Visual Studio"
3
-
description: "How to download, install, and set up the Linux workload for C++ in Visual Studio."
4
-
ms.date: "05/03/2020"
2
+
title: "Install the C++ Linux Workload in Visual Studio"
3
+
description: "Learn how to download, install, and set up the Linux workload for C++ in Visual Studio."
4
+
ms.date: 03/25/2025
5
+
ms.topic: how-to
5
6
ms.custom: intro-installation
6
7
---
7
8
# Download, install, and set up the Linux workload
8
9
9
10
::: moniker range="msvc-140"
10
11
11
-
Linux projects are supported in Visual Studio 2017 and later. To see the documentation for these versions, set the Visual Studio **Version** selector control for this article to Visual Studio 2017or Visual Studio 2019. It's found at the top of the table of contents on this page.
12
+
Linux projects are supported in Visual Studio 2017 and later. To see the documentation for these versions, set the Visual Studio **Version** selector for this article to Visual Studio 2017, Visual Studio 2019, or Visual Studio 2022. It's found at the top of the table of contents on this page.
12
13
13
14
::: moniker-end
14
15
@@ -18,33 +19,33 @@ You can use the Visual Studio IDE on Windows to create, edit, and debug C++ proj
18
19
19
20
You can work on your existing code base that uses CMake without having to convert it to a Visual Studio project. If your code base is cross-platform, you can target both Windows and Linux from within Visual Studio. For example, you can edit, build, and debug your code on Windows using Visual Studio. Then, quickly retarget the project for Linux to build and debug in a Linux environment. Linux header files are automatically copied to your local machine. Visual Studio uses them to provide full IntelliSense support (Statement Completion, Go to Definition, and so on).
20
21
21
-
For any of these scenarios, the **Linux development with C++** workload is required.
22
+
For any of these scenarios, the **Linux and embedded development with C++** workload is required.
22
23
23
24
::: moniker-end
24
25
25
26
::: moniker range=">=msvc-150"
26
27
27
28
## Visual Studio setup
28
29
29
-
1.Type "Visual Studio Installer" in the Windows search box:
30
+
1.Open the Visual Studio Installer from your Start menu. If you can't find it, type *Visual Studio Installer*in the Windows search box and look for the installer under the **Apps** results.
30
31
31
-

32
+
:::image type="content" source="media/visual-studio-installer-search.png" alt-text="Screenshot of the Windows search box that contains the text visual studio installer.":::
32
33
33
-
1.Look for the installer under the **Apps** results and double-click it. When the installer opens, choose **Modify**, and then click on the **Workloads** tab. Scroll down to **Other toolsets** and select the **Linux development with C++** workload.
34
+
1. When the installer opens, choose **Modify**, and then click on the **Workloads** tab. Scroll down to **Other toolsets** and select the **Linux and embedded development with C++** workload.
34
35
35
-
:::image type="complex" source="./media/linuxworkload.png" alt-text="Screenshot highlighting the Visual C++ for Linux Development workload item in Visual Studio Installer.":::
36
-
The Linux Development workload is selected. The Installation details pane is highlighted, which lists what's included in the workload. Which includes: Visual Studio C++ core features, Windows Universal C runtime, Visual C++ for Linux development. An optional component is also selected: Visual C++ tools for CMake and Linux.
36
+
:::image type="complex" source="./media/linux-workload.png" alt-text="Screenshot highlighting the Visual C++ for Linux and embedded development workload item in Visual Studio Installer.":::
37
+
The Linux and embedded development workload is selected. The Installation details pane is highlighted, which lists what's included in the workload. Which includes: Visual Studio C++ core features, Windows Universal C runtime, Visual C++ for Linux development. An optional component is also selected: Visual C++ tools for CMake and Linux.
37
38
:::image-end:::
38
39
39
-
1. If you're targeting IoT or embedded platforms, go to the **Installation details** pane on the right. Under **Linux development with C++**, expand **Optional Components**, and choose the components you need. CMake support for Linux is selected by default.
40
+
1. If you're targeting IoT or embedded platforms, go to the **Installation details** pane on the right. Under **Linux and embedded development with C++**, expand **Optional Components**, and choose the components you need. CMake support for Linux is selected by default.
40
41
41
42
1. Click **Modify** to continue with the installation.
42
43
43
44
## Options for creating a Linux environment
44
45
45
-
If you don't already have a Linux machine, you can create a Linux Virtual Machine on Azure. For more information, see [Quickstart: Create a Linux virtual machine in the Azure portal](/azure/virtual-machines/linux/quick-create-portal).
46
+
If you don't already have a Linux machine, you can create a Linux virtual machine on Azure. For more information, see [Quickstart: Create a Linux virtual machine in the Azure portal](/azure/virtual-machines/linux/quick-create-portal).
46
47
47
-
On Windows 10 and later, you can install and target your favorite Linux distro on the Windows Subsystem for Linux (WSL). For more information, see [Windows Subsystem for Linux Installation Guide for Windows 10](/windows/wsl/install-win10). If you're unable to access the Windows Store, you can [manually download the WSL distro packages](/windows/wsl/install-manual). WSL is a convenient console environment, but it's not recommended for graphical applications.
48
+
On Windows 10 and later, you can install and target your favorite Linux distro on the Windows Subsystem for Linux (WSL). For more information, see [How to install Linux on Windows with WSL](/windows/wsl/install). If you're unable to access the Windows Store, you can [manually download the WSL distro packages](/windows/wsl/install-manual). WSL is a convenient console environment, but it's not recommended for graphical applications.
48
49
49
50
::: moniker-end
50
51
@@ -103,7 +104,7 @@ The target Linux system must have **openssh-server**, **g++**, **gdb**, and **ma
103
104
104
105
You might be prompted for your root password to run the `sudo` command. If so, enter it and continue. Once complete, the required services and tools are installed.
105
106
106
-
1. Ensure the ssh service is running on your Linux computer by running:
107
+
1. Ensure the ssh service is running on your Linux computer:
107
108
108
109
```bash
109
110
sudo service ssh start
@@ -141,19 +142,17 @@ The target machine running Fedora uses the **dnf** package installer. To downloa
141
142
142
143
You might be prompted for your root password to run the sudo command. If so, enter it and continue. Once complete, the required services and tools are installed.
143
144
144
-
1. Ensure the ssh service is running on your Linux computer by running:
145
+
1. Ensure the ssh service is running on your Linux computer:
145
146
146
147
```bash
147
148
sudo systemctl start sshd
148
149
```
149
150
150
151
This command starts the service and runs it in the background, ready to accept connections.
151
152
152
-
## Next Steps
153
+
## Related content
153
154
154
-
You're now ready to create or open a Linux project and configure it to run on the target system. For more information, see:
155
-
156
-
-[Create a new Linux MSBuild C++ project](create-a-new-linux-project.md)
157
-
-[Configure a Linux CMake project](cmake-linux-project.md)
155
+
-[Create a Linux MSBuild C++ project in Visual Studio](create-a-new-linux-project.md)
156
+
-[Create a CMake Linux project in Visual Studio](cmake-linux-project.md)
0 commit comments