|
1 | 1 | ---
|
2 |
| -description: "Learn more about: Visual Studio projects - C++" |
| 2 | +description: "Learn more about: creating and configuring Visual Studio C++ projects" |
3 | 3 | title: "Visual Studio Projects - C++"
|
4 |
| -ms.date: "10/25/2019" |
5 |
| -helpviewer_keywords: ["ATL projects, creating", "Visual Studio C++ projects, creating", "projects [C++], creating", "Visual Studio C++ projects", "ATL projects"] |
6 |
| -ms.assetid: 11003cd8-9046-4630-a189-a32bf3b88047 |
| 4 | +ms.date: 04/19/2022 |
| 5 | +helpviewer_keywords: ["Visual Studio C++ projects, creating", "projects [C++], creating", "Visual Studio C++ projects"] |
7 | 6 | ---
|
8 | 7 | # Visual Studio projects - C++
|
9 | 8 |
|
10 |
| -A *Visual Studio project* is a project based on 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. 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. 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). |
| 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. |
11 | 10 |
|
12 |
| -## Create a project |
| 11 | +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. 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 | +## Create a Visual Studio C++ project |
13 | 14 |
|
14 | 15 | ::: moniker range=">=msvc-160"
|
15 | 16 |
|
16 |
| -You can create C++ projects by choosing **File** > **New** > **Project**, then setting the **Language** to C++. In the results list you see a list of project templates which you can filter by setting the **Platform** or **Project Type** and by typing keywords into the search box. |
| 17 | +1. Create a C++ project by choosing **File** > **New** > **Project**. |
| 18 | +1. Set the **Language** to C++. |
| 19 | +1. In the results list, you'll see a list of project templates. Filter the templates them by setting the **Platform** or **Project Type** and then by typing keywords into the search box. |
17 | 20 |
|
18 |
| -  |
| 21 | +  |
19 | 22 |
|
20 | 23 | ::: moniker-end
|
21 | 24 |
|
22 | 25 | ::: moniker range="msvc-150"
|
23 | 26 |
|
24 |
| -You can create C++ projects by choosing **File** > **New** > **Project**, then choosing Visual C++ in the left pane. In the center pane you see a list of project templates: |
| 27 | +1. Create a C++ project by choosing **File** > **New** > **Project**. |
| 28 | +1. Choose **Visual C++** in the left pane. In the center pane, a list of project templates will appear: |
25 | 29 |
|
26 |
| -  |
| 30 | +  |
27 | 31 |
|
28 | 32 | ::: moniker-end
|
29 | 33 |
|
30 |
| -For more information about all the default project templates that are included in Visual Studio, see [C++ project templates in Visual Studio](reference/visual-cpp-project-types.md). You can create your own project templates. For more information, see [How to: Create project templates](/visualstudio/ide/how-to-create-project-templates). |
| 34 | +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). |
| 35 | + |
| 36 | +You can create your own project templates. For more information, see [How to: Create project templates](/visualstudio/ide/how-to-create-project-templates). |
31 | 37 |
|
32 | 38 | After you create a project, it appears in the [Solution Explorer](/visualstudio/ide/solutions-and-projects-in-visual-studio) window:
|
33 | 39 |
|
34 |
| -  |
| 40 | +  |
| 41 | + |
| 42 | +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**. |
35 | 43 |
|
36 |
| -When you create a new project, a solution file (.sln) is also created. You can add additional projects to the solution by right-clicking on it in **Solution Explorer**. The solution file is used to coordinate build dependencies when you have multiple related projects but doesn't do much more than that. All the compiler options are set at the project level. |
| 44 | +The solution file coordinates build dependencies when you have multiple related projects. Compiler options are set at the project level. |
37 | 45 |
|
38 |
| -## Add items |
| 46 | +## Add code, icons, and other assets to a project |
39 | 47 |
|
40 | 48 | 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**.
|
41 | 49 |
|
42 |
| -## Add third party libraries |
| 50 | +## Add third party libraries to a project |
43 | 51 |
|
44 | 52 | To add third-party libraries, use 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.
|
45 | 53 |
|
46 |
| -## Set compiler options and other build properties |
| 54 | +## Set compiler options and build properties |
47 | 55 |
|
48 | 56 | 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).
|
49 | 57 |
|
50 |
| -## Compile and run |
| 58 | +## Compile and run a project |
51 | 59 |
|
52 | 60 | 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).
|
53 | 61 |
|
54 |
| -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 does not. All errors and warnings will appear both in the Output Window and in the Error List when you build the project. |
| 62 | +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 will appear both in the Output Window and in the Error List when you build the project. |
55 | 63 |
|
56 | 64 | 
|
57 | 65 |
|
58 |
| -In the Error List, you can press **F1** on a highlighted error to go to its documentation topic. |
59 |
| - |
60 |
| -## In This Section |
61 |
| - |
62 |
| -[Set C++ compiler and build properties in Visual Studio](working-with-project-properties.md)<br/> |
63 |
| -How to use Property Pages and Property Sheets to specify your project settings. |
64 |
| - |
65 |
| -[Reference libraries and components at build time](adding-references-in-visual-cpp-projects.md)<br/> |
66 |
| -How to include libs, DLLs, COM and .NET components in a project. |
67 |
| - |
68 |
| -[Organize Project Output Files](how-to-organize-project-output-files-for-builds.md)<br/> |
69 |
| -How to customize the location of the executable files created in the build process. |
70 |
| - |
71 |
| -[Custom Build Steps and Build Events](understanding-custom-build-steps-and-build-events.md)<br/> |
72 |
| -How to add any arbitrary command to the build process at specified points. |
73 |
| - |
74 |
| -[Create a project from existing code](how-to-create-a-cpp-project-from-existing-code.md)<br/> |
75 |
| -How to create a new Visual Studio project from a loose collection of source files. |
| 66 | +In the **Error List**, you can press **F1** on the highlighted error to go to its documentation topic. |
76 | 67 |
|
77 | 68 | ## See also
|
78 | 69 |
|
79 |
| -[Projects and build systems](projects-and-build-systems-cpp.md)<br> |
80 |
| -[Microsoft C++ Porting and Upgrading Guide](../porting/visual-cpp-porting-and-upgrading-guide.md) |
| 70 | +[Create a project from existing code](how-to-create-a-cpp-project-from-existing-code.md)\ |
| 71 | +[Set C++ compiler and build properties in Visual Studio](working-with-project-properties.md)\ |
| 72 | +[Custom build steps and build events](understanding-custom-build-steps-and-build-events.md)\ |
| 73 | +[Reference libraries and components at build time](adding-references-in-visual-cpp-projects.md)\ |
| 74 | +[Organize project output files](how-to-organize-project-output-files-for-builds.md)\ |
| 75 | +[Projects and build systems](projects-and-build-systems-cpp.md)\ |
| 76 | +[Microsoft C++ porting and upgrade guide](../porting/visual-cpp-porting-and-upgrading-guide.md) |
0 commit comments