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/linux/cmake-linux-project.md
+12-8Lines changed: 12 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ For general information about CMake support in Visual Studio, see [CMake Tools f
17
17
18
18
First, make sure you have the **Linux development with C++** workload installed, including the CMake component. See [Install the C++ Linux workload in Visual Studio](download-install-and-setup-the-linux-development-workload.md).
19
19
20
-
On the Linux machine, make sure that the following are installed:
20
+
On the Linux system, make sure that the following are installed:
As soon as you open the folder, Visual Studio parses the CMakeLists.txt file and specifies a Windows target of **x86-Debug**. To target Linux, change the project settings to **Linux-Debug** or **Linux-Release**.
66
+
As soon as you open the folder, Visual Studio parses the CMakeLists.txt file and specifies a Windows target of **x86-Debug**. To target a remote Linux system, change the project settings to **Linux-Debug** or **Linux-Release**.
67
67
68
68
::: moniker range="vs-2019"
69
69
70
-
To target Windows Subsystem for Linux, choose **WSL-Debug**.
70
+
To target Windows Subsystem for Linux, choose **WSL-Debug** or **WSL-Release** if using GCC, or the Clang variants if using the Clang/LLVM toolset.
71
+
72
+
**Visual Studio 2019 version 16.1** When targeting WSL, no copying or sources or headers is necessary because the compiler on Linux has direct access to the Windows file system where your source files are located, and Visual Studio likewise can access the Linux header files directly.
71
73
72
74
::: moniker-end
73
75
74
-
By default, Visual Studio chooses the first remote system in the list under **Tools** > **Options** > **Cross Platform** > **Connection Manager**. If no remote connections are found, you are prompted to create one. For more information, see [Connect to your remote Linux computer](connect-to-your-remote-linux-computer.md).
76
+
For remote targets, Visual Studio by default chooses the first remote system in the list under **Tools** > **Options** > **Cross Platform** > **Connection Manager**. If no remote connections are found, you are prompted to create one. For more information, see [Connect to your remote Linux computer](connect-to-your-remote-linux-computer.md).
77
+
78
+
If you specify a remote Linux target, your source is copied to the remote system.
75
79
76
-
After you specify a Linux target, your source is copied to your Linux machine. Then, CMake is run on the Linux machine to generate the CMake cache for your project.
80
+
After you select a target, CMake runs automatically on the Linux system to generate the CMake cache for your project.
77
81
78
82

79
83
80
-
To provide IntelliSense support for remote headers, Visual Studio automatically copies them from the Linux machine (or WSL installation) to a directory on your local Windows machine. For more information, see [IntelliSense for remote headers](configure-a-linux-project.md#remote_intellisense).
84
+
To provide IntelliSense support for headers on remote Linux systems, Visual Studio automatically copies them from the Linux machine to a directory on your local Windows machine. For more information, see [IntelliSense for remote headers](configure-a-linux-project.md#remote_intellisense).
81
85
82
86
## Debug the project
83
87
84
-
To debug your code on the remote system, set a breakpoint, select the CMake target as the startup item in the toolbar menu next to the project setting, and choose **⏵ Start** on the toolbar, or press F5.
88
+
To debug your code on the specified debug target system, set a breakpoint, select the CMake target as the startup item in the toolbar menu next to the project setting, and choose **⏵ Start** on the toolbar, or press F5.
85
89
86
90
To customize your program’s command line arguments, right-click on the executable in **Solution Explorer** and select **Debug and Launch Settings**. This opens or creates a launch.vs.json configuration file that contains information about your program. To specify additional arguments, add them in the `args` JSON array. For more information, see [Open Folder projects for C++](../build/open-folder-projects-cpp.md) and [Configure CMake debugging sessions](../build/configure-cmake-debugging-sessions.md).
87
91
@@ -159,7 +163,7 @@ You can use these optional settings for more control:
159
163
}
160
164
```
161
165
162
-
These options allow you to run commands on the remote system before and after building, and before CMake generation. The values can be any command that is valid on the remote system. The output is piped back to Visual Studio.
166
+
These options allow you to run commands on the Linux system before and after building, and before CMake generation. The values can be any command that is valid on the remote system. The output is piped back to Visual Studio.
This topic describes how to configure a C++ Linux project as described in [Create a new C++ Linux project in Visual Studio](create-a-new-linux-project.md). For CMake Linux projects, see [Configure a Linux CMake Project ](cmake-linux-project.md).
9
9
10
-
You can configure a Linux project to target a physical Linux machine, a virtual machine, or the [Windows Subsystem for Linux](/windows/wsl/about).
10
+
You can configure a Linux project to target a physical Linux machine, a virtual machine, or the [Windows Subsystem for Linux](/windows/wsl/about) (WSL).
11
11
12
12
::: moniker range="vs-2019"
13
13
14
-
**Visual Studio 2019 version 16.1** You can specify separate Linux targets for building and debugging.
14
+
**Visual Studio 2019 version 16.1**:
15
+
16
+
- When targeting WSL, you can avoid the copy operations that are necessary for building and IntelliSense when targeting remote Linux systems.
17
+
18
+
- You can specify separate Linux targets for building and debugging.
15
19
16
20
::: moniker-end
17
21
@@ -35,10 +39,12 @@ To change settings pertaining to the remote Linux computer, configure the remote
35
39
36
40
::: moniker range="vs-2019"
37
41
38
-
-**Visual Studio 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 WSL shell will appear in their place:
42
+
-**Visual Studio 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:
39
43
40
44

41
45
46
+
If you have side-by-side WSL installations, you can specify a different path here. For example, if you have Ubuntu 18.04 installed, it is located in **C:\Users\\<username>\AppData\Local\Microsoft\WindowsApps\ubuntu1804.exe**.
47
+
42
48
You can specify a different target for debugging on the **Configuration Properties** > **Debugging** page.
43
49
44
50
::: moniker-end
@@ -50,9 +56,15 @@ To change settings pertaining to the remote Linux computer, configure the remote
50
56
> [!NOTE]
51
57
> 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).
52
58
53
-
## Copy sources
59
+
## Copy sources (remote systems only)
54
60
55
-
When building, the source files on your development PC are copied to the Linux computer and compiled there. By default, all sources in the Visual Studio project are copied to the locations set in the settings above. However, additional sources can also be added to the list, or copying sources can be turned off entirely, which is the default for a Makefile project.
61
+
::: moniker range="vs-2019"
62
+
63
+
This section does not apply when targeting WSL.
64
+
65
+
::: moniker-end
66
+
67
+
When building on remote systems, the source files on your development PC are copied to the Linux computer and compiled there. By default, all sources in the Visual Studio project are copied to the locations set in the settings above. However, additional sources can also be added to the list, or copying sources can be turned off entirely, which is the default for a Makefile project.
56
68
57
69
-**Sources to copy** determines which sources are copied to the remote computer. By default, the **\@(SourcesToCopyRemotely)** defaults to all source code files in the project, but does not include any asset/resource files, such as images.
58
70
@@ -68,7 +80,13 @@ Since all compilation is happening on a remote computer (or WSL), several additi
68
80
69
81

70
82
71
-
## <aname="remote_intellisense"></a> IntelliSense for remote headers
83
+
## <aname="remote_intellisense"></a> IntelliSense for headers on remote systems
84
+
85
+
::: moniker range="vs-2019"
86
+
87
+
This section does not apply when targeting WSL.
88
+
89
+
::: moniker-end
72
90
73
91
When you add a new connection in **Connection Manager**, Visual Studio automatically detects the include directories for the compiler on the remote system. Visual Studio then zips up and copies those files to a directory on your local Windows machine. After that, whenever you use that connection in a Visual Studio or CMake project, the headers in those directories are used to provide IntelliSense.
Copy file name to clipboardExpand all lines: docs/linux/download-install-and-setup-the-linux-development-workload.md
+16-8Lines changed: 16 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ On Windows 10, you can install and target your favorite Linux distro on the Wind
55
55
On WSL, no remote connection is required. **zip** and **rsync** are required for automatic syncing of Linux headers with Visual Studio for Intellisense support. If the required applications are not already present, you can install them as follows:
56
56
57
57
```bash
58
-
`sudo g++ gdb make rsync zip`
58
+
sudo g++ gdb make rsync zip
59
59
```
60
60
::: moniker-end
61
61
@@ -67,14 +67,17 @@ The target Linux system must have **openssh-server**, **g++**, **gdb**, and **gd
sudo apt-get install openssh-server g++ gdb gdbserver zip
72
+
```
71
73
72
74
You may be prompted for your root password due to the sudo command. If so, enter it and continue. Once complete, the required services and tools are installed.
73
75
74
76
1. Ensure the ssh service is running on your Linux computer by running:
75
77
76
-
`sudo service ssh start`
77
-
78
+
```bash
79
+
sudo service ssh start
80
+
```
78
81
This starts the service and runs it in the background, ready to accept connections.
79
82
80
83
::: moniker-end
@@ -85,7 +88,9 @@ The target Linux system must have **openssh-server**, **g++**, **gdb**, and **gd
85
88
86
89
Fedora uses the **dnf** package installer. To download **g++**, **gdb**, **rsync** and **zip**, run:
87
90
88
-
`sudo dnf install gcc-g++ gdb rsync zip`
91
+
```bash
92
+
sudo dnf install gcc-g++ gdb rsync zip
93
+
```
89
94
90
95
**zip** and **rsync** are required for automatic syncing of Linux headers with Visual Studio for Intellisense support.
91
96
@@ -99,13 +104,16 @@ The target machine running Fedora uses the **dnf** package installer. To downloa
sudo dnf install openssh-server gcc-g++ gdb gdb-gdbserver zip
109
+
```
104
110
You may be prompted for your root password due to the sudo command. If so, enter it and continue. Once complete, the required services and tools are installed.
105
111
106
112
1. Ensure the ssh service is running on your Linux computer by running:
107
113
108
-
`sudo systemctl start sshd`
114
+
```bash
115
+
sudo systemctl start sshd
116
+
```
109
117
110
118
This starts the service and runs it in the background, ready to accept connections.
Remote debug machine | **Visual Studio 2019 version 16.1**: Specifies the machine to debug the program on. Can be different than the remote build machine that is specified on the **General** page.
10
+
Remote debug machine | **Visual Studio 2019 version 16.1**: Specifies the machine to debug the program on. Can be different than the remote build machine that is specified on the [General](general-linux.md) page.
11
11
Pre-Launch Command | A command that is run on the shell before the debugging starts and before the debugger is running, and can be used to affect the debugging environment.
12
12
Program | The full path to the program to debug on the remote system. This is a path on the remote system. If left empty or unchanged it defaults to the current project output.
13
13
Program Arguments | The command line arguments to pass to the program being debugged.
Copy file name to clipboardExpand all lines: docs/linux/prop-pages/general-linux.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Target Extension | Specifies a file extension that this project will generate. (
14
14
Extensions to Delete on Clean | Semi-colon delimited wildcard specification for which files in the intermediate directory to delete on clean or rebuild.
15
15
Build Log File | Specifies the build log file to write to when build logging is enabled.
16
16
Platform Toolset | Specifies the toolset used for building the current configuration; If not set, the default toolset is used
17
-
Remote Build Machine | The target machine or device to use for remote build, deploy and debug.
17
+
Remote Build Machine | The target machine or device to use for remote build, deploy and debug.**Visual Studio 2019 version 16.1** A different machine for debugging can be specified in the [Debugging](debugging-linux.md) page.
18
18
Remote Build Root Directory | Specifies a path to a directory on the remote machine or device.
19
19
Remote Build Project Directory | Specifies a path to a directory on the remote machine or device for the project.
20
20
Configuration Type | Specifies the type of output this configuration generates. | **Dynamic Library (.so)** - Dynamic Library (.so)<br>**Static library (.a)** - Static Library (.a)<br>**Application (.out)** - Application (.out)<br>**Makefile** - Makefile<br>
0 commit comments