Skip to content

Commit 2f61867

Browse files
authored
Merge pull request MicrosoftDocs#759 from mikeblome/mb-linux-intellisense
new content for remote IntelliSense
2 parents a9595a2 + e0ad0ca commit 2f61867

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

docs/linux/cmake-linux-project.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
title: "Configure a Linux CMake project in Visual Studio | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "10/25/2107"
4+
ms.date: "04/28/2018"
5+
ms.reviewer: ""
6+
ms.suite: ""
57
ms.technology: ["cpp-linux"]
68
ms.tgt_pltfrm: "Linux"
79
ms.topic: "conceptual"
@@ -38,7 +40,8 @@ int main(int argc, char* argv[])
3840
}
3941
```
4042
41-
CMakeLists.txt:
43+
CMakeLists.txt:
44+
4245
```cmd
4346
project (hello-cmake)
4447
add_executable(hello-cmake hello.cpp)
@@ -53,6 +56,9 @@ After you specify a Linux target, your source is copied to your Linux machine. T
5356

5457
![Generate CMake cache on Linux](media/cmake-linux-1.png "Generate the CMake cache on Linux")
5558

59+
**Visual Studio 2017 version 15.7 and later:**
60+
To provide IntelliSense support for remote headers, Visual Studio automatically copies them to a directory on your local Windows machine. For more information, see [IntelliSense for remote headers](configure-a-linux-project.md#remote_intellisense).
61+
5662
## Debug the project
5763
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 click run (or press F5).
5864

@@ -78,6 +84,7 @@ To change the default CMake settings, choose **CMake | Change CMake Settings | C
7884
"inheritEnvironments": [ "linux-x64" ]
7985
}
8086
```
87+
8188
The `name` value can be whatever you like. The `remoteMachineName` value specifies which remote system to target, in case you have more than one. IntelliSense is enabled for this field to help you select the right system. The field `remoteCMakeListsRoot` specifies where your project sources will be copied to on the remote system. The field `remoteBuildRoot` is where the build output will be generated on your remote system. That output is also copied locally to the location specified by `buildRoot`.
8289

8390
## Building a supported CMake release from source

docs/linux/configure-a-linux-project.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
title: "Configure a C++ Linux project in Visual Studio | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/15/2017"
4+
ms.date: "04/28/2018"
5+
ms.reviewer: ""
6+
ms.suite: ""
57
ms.technology: ["cpp-linux"]
68
ms.tgt_pltfrm: "Linux"
79
ms.topic: "conceptual"
@@ -33,8 +35,11 @@ To change settings pertaining to the remote Linux computer, configure the remote
3335
> [!NOTE]
3436
> 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.
3537
36-
## VC++ directories
37-
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. 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).
38+
## Include directories and IntelliSense support
39+
40+
**Visual Studio 2017 version 15.6 and earlier:**
41+
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.
42+
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).
3843

3944
You can copy the files by using a command similar to the following:
4045

@@ -46,6 +51,9 @@ Once the files are copied, use the **VC++ Directories** item in Project properti
4651

4752
![VC++ Directories](media/settings_directories.png)
4853

54+
**Visual Studio 2017 version 15.7 and later:**
55+
See [Manage Remote Headers for IntelliSense](#remote_intellisense).
56+
4957
## Copy sources
5058
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.
5159

@@ -62,6 +70,20 @@ Since all compilation is happening on a remote computer, several additional Buil
6270

6371
![Build Events](media/settings_buildevents.png)
6472

73+
## <a name="remote_intellisense"></a> IntelliSense for remote headers (Visual Studio 2017 version 15.7 and later)
74+
75+
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.
76+
77+
This functionality depends on the Linux machine having zip installed. You can install zip by using this apt-get command:
78+
79+
```cmd
80+
apt install zip
81+
```
82+
83+
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**.
84+
85+
![Remote Header IntelliSense](media/remote-header-intellisense.png)
86+
6587
## See Also
6688
[Working with Project Properties](../ide/working-with-project-properties.md)
6789
[C++ General Properties (Linux C++)](../linux/prop-pages/general-linux.md)
27.9 KB
Loading

0 commit comments

Comments
 (0)