Skip to content

Commit 815c22a

Browse files
committed
update
1 parent 20e51db commit 815c22a

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Documentation/Getting started.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,25 @@ This page describes how to configure include paths for folders containing C or C
44

55
![Configure includePath for better IntelliSense](https://github.com/Microsoft/vscode-cpptools/raw/ronglu-edit/Images/configure%20includepath.jpg)
66

7-
## How to configure the include paths
7+
## Where are the include paths defined?
88

9-
When you open a folder, the extension will attempt to locate your system headers based on your operating system, but it does not know about any auxiliary libraries that your project depends on. You can specify the remaining paths by either using the `"C/Cpp: Edit Configurations"` command in the command palette, or by selecting `"Edit "includePath" setting"` in the lightbulb menu (see the screenshot below). The quickiest way to locate the lightbulb is to scroll to the top of the source file and click on any green squiggle, which usually shows up at the first line in the file.
9+
The include paths are defined in the `"includePath"` setting in a file called **c_cpp_properties.json** located in the .vscode directory in the opened folder.
1010

11-
![lightbulb menu "Edit "includePath" setting"](https://github.com/Microsoft/vscode-cpptools/raw/master/Images/Lightbulb.png)
11+
You can create or open this file by either using the `"C/Cpp: Edit Configurations"` command in the command palette, or by selecting `"Edit "includePath" setting"` in the lightbulb menu (see the screenshot below). The quickiest way to locate the lightbulb is to scroll to the top of the source file and click on any green squiggle, which usually shows up at the first line in the file.
1212

13-
This creates or opens a file called **c_cpp_properties.json** in the .vscode directory in the opened folder. In this file, you can specify the paths to the headers that your project depends on. Look for the section where your current configuration is defined (by default there's one configuration per OS, such as "Win32 or "Mac"), and add your paths in the `"includePath"` setting and defines in the `"defines"` setting. For example, the following screenshot shows a snippet of the file specifying path for the Mac configuration.
13+
![lightbulb menu "Edit "includePath" setting"](https://github.com/Microsoft/vscode-cpptools/raw/ronglu-edit/Images/Lightbulb.png)
1414

15-
![c_cpp_properties file snippet](https://github.com/Microsoft/vscode-cpptools/raw/ronglu-edit/Images/c_cpp_properties%20file.PNG)
16-
17-
You can either hover over the green squiggles to see the message in the tooltip, or open the Problems window to understand which headers the IntelliSense engine is unable to open.
15+
When a folder is opened, the extension will attempt to locate your system headers based on your operating system, but it does not know about any auxiliary libraries that your project depends on. You can hover over the green squiggles or open the Problems window to understand which headers the IntelliSense engine is unable to open.
1816

1917
![include error message](https://github.com/Microsoft/vscode-cpptools/raw/ronglu-edit/Images/Include%20errors.png)
2018

21-
## Tips for setting up include paths quickly
19+
## How to specify the include paths?
2220

23-
Manually configuring includes and defines could be time-consuming and sometimes cumbersome. It is recommended to try the following techniques to get the include paths setup automatically before resorting to manually configuring in the **c_cpp_properties.json** file.
21+
You can specify the remaining paths using one of the techniques described below.
2422

2523
#### 1. Use the lightbulb suggestions to auto-resolve includePath
2624

27-
You can also leverage the lightbulb path suggestions lightbulb to auto-resolve the included file. When you open a folder, the extension will **recursively** search for potential include paths that match the header files your code is using based on the paths set by the `"browse.path"` setting in **c_cpp_properties.json**. Click on the green squiggles under #include statements and a lightbulb will appear and offer suggestions of paths that will allow IntelliSense to resolve the included file.
25+
The first thing to try is to leverage the lightbulb path suggestions lightbulb to auto-resolve the included file. When you open a folder, the extension will **recursively** search for potential include paths that match the header files your code is using based on the paths set by the `"browse.path"` setting in **c_cpp_properties.json**. Click on the green squiggles under #include statements and a lightbulb will appear and offer suggestions of paths that will allow IntelliSense to resolve the included file.
2826

2927
![lightbulb suggestions](https://github.com/Microsoft/vscode-cpptools/raw/ronglu-edit/Images/lightbulb%20suggestion.png)
3028

@@ -34,6 +32,11 @@ If your build system is able to produce a compile_commands.json file, which can
3432

3533
![use compileCommands setting](https://github.com/Microsoft/vscode-cpptools/raw/ronglu-edit/Images/compile_commands.png)
3634

35+
#### 3. Manually add include paths
36+
If none of the above fully resolve the paths, you could manually specify the paths to the headers that your project depends on to the **c_cpp_properties.json** file. Look for the section where your current configuration is defined (by default there's one configuration per OS, such as "Win32 or "Mac"), and add your paths in the `"includePath"` setting and defines in the `"defines"` setting. For example, the following screenshot shows a snippet of the file specifying path for the Mac configuration.
37+
38+
![c_cpp_properties file snippet](https://github.com/Microsoft/vscode-cpptools/raw/ronglu-edit/Images/c_cpp_properties%20file.PNG)
39+
3740
## Verify the include paths are correctly resolved
3841

3942
There are two ways to verify that the include paths are correctly resolved:

0 commit comments

Comments
 (0)