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
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Configure a Linux CMake project in Visual Studio"
3
3
description: "How to configure, edit and compile a Linux CMake project in Visual Studio"
4
-
ms.date: "05/21/2019"
4
+
ms.date: "06/07/2019"
5
5
ms.assetid: f8707b32-f90d-494d-ae0b-1d44425fdc25
6
6
---
7
7
@@ -26,16 +26,16 @@ On the Linux machine, make sure that the following are installed:
26
26
27
27
::: moniker range="vs-2019"
28
28
29
-
Linux support for CMake projects requires a recent version of CMake to be installed on the target machine. Often, the version offered by a distribution’s default package manager is not recent enough to support all the IDE’s features. Visual Studio 2019 can automatically install a user local copy of CMake on remote Linux machines that don’t have a recent version of CMake installed. If a compatible version of CMake isn’t detected the first time you build your project, you will see an info-bar offering to install CMake.
30
-
31
-
The binaries will be installed to `~/.vs/cmake`. After deploying the binaries, your project will automatically regenerate. Note that if the CMake specified by the `cmakeExecutable` field in `CMakeSettings.json` is invalid (doesn't exist or is an unsupported version) and the prebuilt binaries are present Visual Studio will ignore `cmakeExecutable` and use the prebuilt binaries.
29
+
Linux support for CMake projects requires a recent version of CMake to be installed on the target machine. Often, the version offered by a distribution’s default package manager is not recent enough to support all the features that are required by Visual Studio. Visual Studio 2019 detects whether a recent version of CMake is installed on the Linux system. If none is found, Visual Studio shows an info-bar at the top of the editor pane that offers to install it for you.
32
30
33
31
::: moniker-end
34
32
35
33
::: moniker range="vs-2017"
36
34
37
35
The CMake support in Visual Studio requires the server mode support that was introduced in CMake 3.8. For a Microsoft-provided CMake variant, download the latest prebuilt binaries at [https://github.com/Microsoft/CMake/releases](https://github.com/Microsoft/CMake/releases).
38
36
37
+
The binaries will be installed to `~/.vs/cmake`. After deploying the binaries, your project will automatically regenerate. Note that if the CMake specified by the `cmakeExecutable` field in `CMakeSettings.json` is invalid (doesn't exist or is an unsupported version) and the prebuilt binaries are present Visual Studio will ignore `cmakeExecutable` and use the prebuilt binaries.
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 Linux, change the project settings to **Linux-Debug** or **Linux-Release**.
67
+
68
+
::: moniker range="vs-2019"
69
+
70
+
To target Windows Subsystem for Linux, choose **WSL-Debug**.
71
+
72
+
::: moniker-end
67
73
68
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).
69
75
70
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.
71
77
72
78

73
79
74
-
To provide IntelliSense support for remote headers, 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).
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).
75
81
76
82
## Debug the project
77
83
@@ -87,7 +93,7 @@ A CMakeSettings.json file in a CMake Linux project can specify all the propertie
87
93
88
94
To change the default CMake settings in Visual Studio 2019, from the main toolbar, open the **Configuration** drop down and choose **Manage Configurations**.
This brings up the **CMake Settings Editor** which you can use to edit the `CMakeSettings.json` file in your root project folder. You can also open the file directly by clicking the **Edit JSON** button in the editor. For more information, see [Customize CMake Settings](../build/customize-cmake-settings.md).
Copy file name to clipboardExpand all lines: docs/linux/configure-a-linux-project.md
+47-31Lines changed: 47 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,73 +1,74 @@
1
1
---
2
2
title: "Configure a C++ Linux project in Visual Studio"
3
-
ms.date: "11/12/2018"
3
+
ms.date: "06/07/2019"
4
4
ms.assetid: 4d7c6adf-54b9-4b23-bd23-5de0c825b768
5
5
---
6
-
# Configure a Linux Project
6
+
# Configure a Linux project
7
7
8
-
This topic describes how to configure a C++ Linux project that is based on a Linux project template in Visual Studio. For information about CMake Linux Projects in Visual Studio, see [Configure a Linux CMake Project ](cmake-linux-project.md).
8
+
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
+
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).
11
+
12
+
::: moniker range="vs-2019"
13
+
14
+
**Visual Studio 2019 version 16.1** You can specify separate Linux targets for building and debugging.
15
+
16
+
::: moniker-end
9
17
10
18
## General settings
11
19
12
-
A variety of options can be configured for a Linux project with Visual Studio. To view these options, select the **Project > Properties** menu, or right click on the project in **Solution Explorer** and select **Properties** from the context menu. The **General** settings appear.
20
+
To view configuration options, select the **Project > Properties** menu, or right click on the project in **Solution Explorer** and select **Properties** from the context menu. The **General** settings appear.
By default, an executable (.out) is built with the tool. To build a static or dynamic library, or to use an existing Makefile, use the **Configuration Type**selection.
24
+
By default, an executable (.out) is built with the tool. To build a static or dynamic library, or to use an existing Makefile, use the **Configuration Type**setting.
17
25
18
-
For more information about the options in the property pages, see [Linux Project Property Page Reference](prop-pages-linux.md).
26
+
For more information about the settings in the property pages, see [Linux Project Property Page Reference](prop-pages-linux.md).
19
27
20
28
## Remote settings
21
29
22
-
To change settings pertaining to the remote Linux computer, configure the remote options that appear in the [General](prop-pages/general-linux.md) settings:
30
+
To change settings pertaining to the remote Linux computer, configure the remote settings that appear under [General](prop-pages/general-linux.md).
23
31
24
-
- To change the target Linux computer, use the **Remote Build Machine** entry. This will allow you to select one of the connections created previously. To create a new entry, please see the [Connecting to Your Remote Linux Computer](connect-to-your-remote-linux-computer.md) section.
32
+
- To specify a remote target Linux computer, use the **Remote Build Machine** entry. This will allow you to select one of the connections created previously. To create a new entry, see the [Connecting to Your Remote Linux Computer](connect-to-your-remote-linux-computer.md) section.
25
33
26
-
- The **Remote Build Root Directory** determines the root location of where the project is built on the remote Linux computer. This will default to **~/projects** unless changed.
- 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.
36
+
::: moniker range="vs-2019"
29
37
30
-
> [!NOTE]
31
-
> 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. These could be set to use a certain version of GCC, or even the Clang compiler, 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).
32
-
33
-
## Include directories and IntelliSense support
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:
34
39
35
-
**Visual Studio 2017 version 15.6 and earlier:**<br/>
36
-
By default, Visual Studio does not include any system-level include files from the Linux computer. For example, items in the **/usr/include** directory are not present in Visual Studio.
37
-
For full [IntelliSense](/visualstudio/ide/using-intellisense) support, you will need to copy those files to some location on your development computer and point Visual Studio to this location. One option is to use scp (Secure Copy) to copy the files. On Windows 10, you can use [Bash on Windows](https://msdn.microsoft.com/commandline/wsl/about) to run scp. For previous versions of Windows, you could use something like [PSCP (PuTTY Secure Copy)](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).
40
+

38
41
39
-
You can copy the files by using a command similar to the following:
42
+
You can specify a different target for debugging on the **Configuration Properties** > **Debugging** page.
Of course, replace the **linux_username** and **remote_host** values above for what's appropriate in your own environment.
46
+
- The **Remote Build Root Directory** determines the root location of where the project is built on the remote Linux computer. This will default to **~/projects** unless changed.
44
47
45
-
Once the files are copied, use the **VC++ Directories** item in Project properties to tell Visual Studio where to find the additional include files that were just copied.
48
+
- 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.
**Visual Studio 2017 version 15.7 and later:**<br/>
50
-
See [Manage Remote Headers for IntelliSense](#remote_intellisense).
50
+
> [!NOTE]
51
+
> 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).
51
52
52
53
## Copy sources
53
54
54
-
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.
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.
55
56
56
-
-**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.
57
+
-**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.
57
58
58
59
-**Copy sources** can be turned on and off to enable and disable the copying of source files to the remote computer.
59
60
60
-
-**Additional sources to copy** allows you to add additional source files which will be copied to the remote system. You can specify a semi-colon delimited list, or you can use the **:=** syntax to specify a local and remote name to use:
61
+
-**Additional sources to copy** allows you to add additional source files which will be copied to the remote system. You can specify a semi-colon delimited list, or you can use the **:=** syntax to specify a local and remote name to use:
Since all compilation is happening on a remote computer, several additional Build Events have been added to the Build Events section in Project Properties. These are **Remote Pre-Build Event**, **Remote Pre-Link Event**, and **Remote Post-Build Event**, and will occur on the remote computer before or after the individual steps in the process.
67
+
Since all compilation is happening on a remote computer (or WSL), several additional Build Events have been added to the Build Events section in Project Properties. These are **Remote Pre-Build Event**, **Remote Pre-Link Event**, and **Remote Post-Build Event**, and will occur on the remote computer before or after the individual steps in the process.
67
68
68
69

69
70
70
-
## <aname="remote_intellisense"></a> IntelliSense for remote headers (Visual Studio 2017 version 15.7 and later)
71
+
## <aname="remote_intellisense"></a> IntelliSense for remote headers
71
72
72
73
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.
73
74
@@ -77,10 +78,25 @@ This functionality depends on the Linux machine having zip installed. You can in
77
78
apt install zip
78
79
```
79
80
80
-
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 version 15.3, select the connect and then select **Download**.
81
+
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**.
Copy file name to clipboardExpand all lines: docs/linux/connect-to-your-remote-linux-computer.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,19 @@
1
1
---
2
2
title: "Connect to your remote Linux computer in Visual Studio"
3
3
description: "How to connect to a remote Linux machine from inside a Visual Studio C++ project."
4
-
ms.date: "07/20/2018"
4
+
ms.date: "06/07/2019"
5
5
ms.assetid: 5eeaa683-4e63-4c46-99ef-2d5f294040d4
6
6
---
7
7
8
8
# Connect to your remote Linux computer
9
9
10
-
When building a C++ Linux project in Visual Studio, Linux code is copied to your remote Linux computer and then compiled based on Visual Studio settings. To set up this remote connection:
10
+
::: moniker range="vs-2019"
11
+
12
+
When you target Windows Subsystem for Linux (WSL) Visual Studio interacts with your Linux distro directly through the file system; no remote connection is necessary.
13
+
14
+
::: moniker-end
15
+
16
+
When building a C++ Linux project for a remote Linux system (VM or physical machine), Linux code is copied to your remote Linux computer and then compiled based on Visual Studio settings. To set up this remote connection:
11
17
12
18
1. Build the project for the first time or manually create a new entry by selecting **Tools > Options** and then open the **Cross Platform > Connection Manager** node and click the **Add** button.
0 commit comments