[C++] 1-1.5 visual studio 2019 create solutions and add engineering projects

[C++] 1-1.5 visual studio 2019 create solutions and add engineering projects

1. Background

Operating system: IDE
used by windows10 : visual studio comunity 2019
visual studio uses a solution for project management. The solution is a container for one or more projects in visual studio.

Multiple engineering projects can be created under the solution.

This blog explains how to create solutions and engineering projects, and how to switch between multiple engineering projects.

2. Create a solution

The solution solution is hidden in the "Configure New Project" dialog box.
The file extension of the solution is .sln

The following demonstrates how to create it.

Double-click to open visual studio 2019 and
click Create Project (N), as shown in Figure 1:
Insert picture description here
Click "Empty Project", and then click "Next";
as shown in Figure 2:
Insert picture description here
Fill in the "Configure New Project":
project name: unit01
location: E: \E03_Temp\teaching
solution name: jn10010537
click to create, as shown in Figure 3: After
Insert picture description here
creation
, generate jn10010537 folder under the path of E:\E03_Temp\teaching as shown in Figure 4;

And created the unit01 folder and jn10010537.sln (the suffix of the solution file is .sln) under the path E:\E03_Temp\teaching\jn10010537, as shown in Figure 5;

Create unit01.vcxproj, unit01.vcxproj.filters, unit01.vcxproj.user configuration files under the path E:\E03_Temp\teaching\jn10010537\unit01, as shown in Figure 6 below;

Figure 4:
Insert picture description here
Figure 5:
Insert picture description here
Figure 6:
Insert picture description here

3. Add project

After creating the jn10010537 solution and unit01 project according to the above, the interface of visual studio 2019 is as shown in Figure 7:
Insert picture description here
The following demonstrates how to create a new project under the jn10010537 solution.

Right-click the solution "jn10010537" -> "Add" -> "New Project"
as shown in Figure 8:
Insert picture description here
In the pop-up new dialog box, click "Empty Project" -> "Next", as shown in Figure 9:
Insert picture description here
in the pop-up Under Configure New Project, fill in:
Project name: unit02
Location: Select the default E:\E03_Temp\teaching\jn10010537 folder.
Click Create.
As shown in Figure 10:
Insert picture description here

After
creation, the unit02 folder is created under the path E:\E03_Temp\teaching\jn10010537, as shown in Figure 11;

Create unit02.vcxproj, unit02.vcxproj.filters, unit02.vcxproj.user configuration files under the path E:\E03_Temp\teaching\jn10010537\unit02, as shown in Figure 12;

Figure 11:
Insert picture description here
Figure 12:
Insert picture description here
At the same time, the interface of visual studio 2019 is as shown in Figure 13:
Insert picture description here

4. Set up startup items

Careful you will find that
no matter how the mouse clicks on the unit02 project, the unit02 display is not bold, but the unit01 display is bold.

Why is this?
Because unit01 is the first project created, VS takes the first project as the startup project by default. In the process of running and debugging, unit01 is used as the startup project.

Solution 1:
Right-click "unit02" -> "Set as startup project"
as shown in Figure 14:
Insert picture description here

Solution 2:
Right-click the solution "jn10010537" -> "Properties
" and click "Current Selection" in "Startup Items" under "General Properties";
as shown in Figure 15:
Insert picture description here

Guess you like

Origin blog.csdn.net/jn10010537/article/details/115056130