Skip to content

Commit ab58b11

Browse files
author
mikeblome
committed
proofread pass and image update
1 parent e8e43ce commit ab58b11

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

-27.9 KB
Binary file not shown.

docs/build/open-folder-projects-cpp.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ CMake is integrated in the Visual Studio IDE as a component of the C++ desktop w
1414

1515
## Other build systems
1616

17-
To use the Visual Studio IDE with a build system or compiler toolset that is not directly supported (for example, make, gyp, SCons, Gradle, Buck, and so on), from the main menu select **File | Open | Folder** or press **Ctrl + Shift + Alt + O**. Navigate to the folder that contains your source code files. To build the project, define custom tasks, or configure IntelliSense for system headers, you add three JSON files:
17+
To use the Visual Studio IDE with a build system or compiler toolset that is not directly supported from the main menu select **File | Open | Folder** or press **Ctrl + Shift + Alt + O**. Navigate to the folder that contains your source code files. To build the project, define custom tasks, or configure IntelliSense for system headers, you add three JSON files:
1818

1919
| | |
2020
|-|-|
@@ -24,7 +24,7 @@ To use the Visual Studio IDE with a build system or compiler toolset that is not
2424

2525
### Configure IntelliSense and browsing hints with CppProperties.json
2626

27-
For IntelliSense and browsing behavior such as **Go to Definition** to work correctly, Visual Studio needs to know which compiler you are using, where the system headers are, and where any additional include files are located if they are not directly in the folder you have opened (the workspace folder). To specify a configuration, you can choose **Manage Congfigurations** from the dropdown in the main toolbar:
27+
For IntelliSense and browsing behavior such as **Go to Definition** to work correctly, Visual Studio needs to know which compiler you are using, where the system headers are, and where any additional include files are located if they are not directly in the folder you have opened (the workspace folder). To specify a configuration, you can choose **Manage Configurations** from the dropdown in the main toolbar:
2828

2929
![Manage configurations dropdown](media/manage-configurations-dropdown.png)
3030

@@ -58,9 +58,9 @@ If, for example, you choose **x64-Debug**, Visual Studio creates a file called `
5858
}
5959
```
6060

61-
This configuration "inherits" the environment variables of the Visual Studio [x64 Developer Command Prompt](building-on-the-command-line.md). One of those variables is `INCLUDE` and you can refer to it here by using the `${env.INCLUDE}` macro. The `includePath` property tells Visual Studio where to look for all the sources that it needs for IntelliSense. In this case, it says "look in the all the directories specified by the INCLUDE environment variable, and also all the directories in the current working folder tree. The `name` property is the name that will appear in the dropdown, and can be anything you like. The `defines` property provides hints to IntelliSense when it encounters conditional compilation blocks. The `intelliSenseMode` property provides some additional hints based on the compiler type. Several options are available for MSVC, GCC, and Clang.
61+
This configuration "inherits" the environment variables of the Visual Studio [x64 Developer Command Prompt](building-on-the-command-line.md). One of those variables is `INCLUDE` and you can refer to it here by using the `${env.INCLUDE}` macro. The `includePath` property tells Visual Studio where to look for all the sources that it needs for IntelliSense. In this case, it says "look in the all the directories specified by the INCLUDE environment variable, and also all the directories in the current working folder tree." The `name` property is the name that will appear in the dropdown, and can be anything you like. The `defines` property provides hints to IntelliSense when it encounters conditional compilation blocks. The `intelliSenseMode` property provides some additional hints based on the compiler type. Several options are available for MSVC, GCC, and Clang.
6262

63-
If you are using a different compiler, you have to create a custom configuration and environment in *cppproperties.json*. The following example shows a complete *cppproperties.json* file with a single custom configuration for using GCC in an MSYS2 installation:
63+
If you are using a compiler other than Microsoft C++, you have to create a custom configuration and environment in *cppproperties.json*. The following example shows a complete *cppproperties.json* file with a single custom configuration for using GCC in an MSYS2 installation:
6464

6565
```json
6666
{
@@ -92,6 +92,9 @@ If you are using a different compiler, you have to create a custom configuration
9292

9393
Note the `environments` block. It defines properties that behave like environment variables and are available not only in the *cppproperties.json* file, but also in the other configuration files *task.vs.json* and *launch.vs.json*. The `Mingw64` configuration inherits the `mingw_w64` environment, and uses its INCLUDE property to specify the value for `includePath`. You can add other paths to this array property as needed.
9494

95+
> [!WARNING]
96+
> There is currently a known issue in which the `INCLUDE` value specified in `environments` is not correctly passed to the `includePath` property. You can work around the issue by adding the complete literal include paths to the `includePath` array.
97+
9598
The `intelliSenseMode` property is set to a value appropriate for GCC. For more information on all these properties, see [CppProperties schema reference](cppproperties-schema-reference.md).
9699

97100
When everything is working correctly, you will see IntelliSense from the GCC headers when you hover over a type:
@@ -102,16 +105,13 @@ If you are not seeing the IntelliSense that you expect, you can troubleshoot by
102105

103106
![Diagnostic logging](media/diagnostic-logging.png)
104107

105-
Output is piped to the **Output Window** and is visible when you choose **Show Output From: Visual C++ Log*. The output contains, among other things, the list of actual include paths that IntelliSense is trying to use.
106-
107-
> [!WARNING]
108-
> There is currently a known issue in which the `INCLUDE` value specified in `environments` is not correctly passed to the `includePath` property. You can work around the issue by adding the complete literal include paths to the `includePath` array.
108+
Output is piped to the **Output Window** and is visible when you choose **Show Output From: Visual C++ Log*. The output contains, among other things, the list of actual include paths that IntelliSense is trying to use. If the paths do not match the ones in *cppproperties.json*, try closing the folder and deleting the *.vs* subfolder which contains cached browsing data.
109109

110110
### Define build tasks with tasks.vs.json
111111

112112
You can automate build scripts or any other external operations on the files you have in your current workspace by running them as tasks directly in the IDE. You can configure a new task by right-clicking on a file or folder and selecting **Configure Tasks**.
113113

114-
![Open Folder Configure Tasks](media/open-folder-config-tasks.png)
114+
![Open Folder Configure Tasks](media/configure-tasks.png)
115115

116116
This creates (or opens) the *tasks.vs.json* file in the .vs folder which Visual Studio creates in your root project folder. You can define any arbitrary task in this file and then invoke it from the **Solution Explorer** context menu. To continue with the GCC example, the following example shows a complete *tasks.vs.json* file with as single task that invokes *g++.exe* to build a project. Assume the project contains a single file called *hello.cpp*.
117117

@@ -136,7 +136,7 @@ This creates (or opens) the *tasks.vs.json* file in the .vs folder which Visual
136136

137137
```
138138

139-
You can now run this task by right-clicking on the project node in **Solution Explorer** and choosing **build hello**. When the task completes you should see a new file, *hello.exe* in **Solution Explorer**.
139+
The file is placed in the *.vs* subfolder which you can see if you click on **Show All Files** at the top of **Solution Explorer**. You can run this task by right-clicking on the project node in **Solution Explorer** and choosing **build hello**. When the task completes you should see a new file, *hello.exe* in **Solution Explorer**.
140140

141141
You can define many kinds of tasks. The following example shows a tasks.vs.json file that defines a single task. `taskName` defines the name that appears in the context menu. `appliesTo` defines which files the command can be performed on. The `command` property refers to the COMSPEC environment variable, which identifies the path for the console (*cmd.exe* on Windows). You can also reference environment variables that are declared in CppProperties.json or CMakeSettings.json. The `args` property specifies the command line to be invoked. The `${file}` macro retrieves the selected file in **Solution Explorer**. The following example will display the filename of the currently selected .cpp file.
142142

@@ -187,8 +187,7 @@ To start debugging, choose the executable in the debug dropdown, then click the
187187

188188
![Launch debugger](media/launch-debugger-gdb.png)
189189

190-
You should see the **Initializing Debugger** dialog and then an external console window that is running your program.
191-
190+
You should see the **Initializing Debugger** dialog and then an external console window that is running your program.
192191

193192
You can define launch settings for any executable on your computer. The following example launches *7za* and specifies additional arguments, by adding them to the `args` JSON array:
194193

0 commit comments

Comments
 (0)