Skip to content

Commit 929fb58

Browse files
authored
Feature 363608: Q&M: Content Freshness for C++ Content -- batch 6 (#13753)
* Refresh article * Fix casing * Fix image names
1 parent f711522 commit 929fb58

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed
-5.17 KB
Binary file not shown.
-2.42 KB
Binary file not shown.
5.8 KB
Loading
3.38 KB
Loading
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
11
---
2-
title: Configure a C++ project for IntelliSense
2+
title: Configure a C++ Project for IntelliSense
33
description: Configure your C++ project manually to get IntelliSense working properly by using the Visual Studio IDE to help you identify and fix IntelliSense problems.
4-
ms.date: 10/08/2018
5-
ms.topic: conceptual
4+
ms.date: 03/26/2025
5+
ms.topic: concept-article
66
author: tylermsft
77
ms.author: twhitney
88
manager: markl
99
---
1010
# Configure a C++ project for IntelliSense
1111

12-
In some cases, you might need to manually configure your C++ project to get IntelliSense working properly. For MSBuild projects (based on .vcxproj files), you can adjust settings in project properties. For non-MSBuild projects, you adjust settings in the CppProperties.json file in the root directory of the project. In some cases, you may need to create a hint file to help IntelliSense understand macro definitions. The Visual Studio IDE helps you identify and fix IntelliSense problems.
12+
In some cases, you might need to manually configure your C++ project to get IntelliSense working properly. For MSBuild projects (based on *`.vcxproj`* files), you can adjust settings in project properties. For non-MSBuild projects, you adjust settings in the *`CppProperties.json`* file in the root directory of the project. In some cases, you might need to create a hint file to help IntelliSense understand macro definitions. The Visual Studio IDE helps you identify and fix IntelliSense problems.
1313

1414
## Single-file IntelliSense
1515

16-
When you open a file that is not included in a project, Visual Studio provides some IntelliSense support but by default no error squiggles are shown. If the **Navigation Bar** says *Miscellaneous Files*, then that probably explains why you are not seeing error squiggles under incorrect code, or why a preprocessor macro is not defined.
16+
When you open a file that isn't included in a project, Visual Studio provides some IntelliSense support, but by default no error squiggles are shown. If the **Navigation Bar** says **Miscellaneous Files**, then that probably explains why you don't see error squiggles under incorrect code, or why a preprocessor macro isn't defined.
1717

1818
## Check the Error List
1919

20-
If a file is not open in single-file mode, and IntelliSense is not working correctly, the first place to check is the Error List window. To see all the IntelliSense errors for the current source file together with all included header files, choose **Build + IntelliSense** in the dropdown:
20+
If a file isn't open in single-file mode, and IntelliSense isn't working correctly, the first place to check is the **Error List** window. To see all the IntelliSense errors for the current source file together with all included header files, choose **Build + IntelliSense** in the dropdown:
2121

22-
![VC++ IntelliSense in Error List](media/vcpp-intellisense-error-list.png)
22+
:::image type="content" source="media/visual-cpp-intellisense-error-list.png" alt-text="Screenshot that shows the IntelliSense Error List window.":::
2323

24-
IntelliSense produces a maximum of 1000 errors. If there are over 1000 errors in the header files included by a source file, then the source file shows only a single error squiggle at the very start of the source file.
24+
IntelliSense produces a maximum of 1,000 errors. If there are more than 1,000 errors in the header files included by a source file, then the source file shows only a single error squiggle at the very start of the source file.
2525

2626
## Ensure #include paths are correct
2727

2828
### MSBuild projects
2929

30-
If you run your builds outside of the Visual Studio IDE, and your builds are succeeding but IntelliSense is incorrect, it is possible that your command line is out of sync with the project settings for one or more configurations. Right-click on the project node in **Solution Explorer** and make sure that all **#include** paths are correct for the current configuration and platform. If the paths are identical in all configurations and platforms, you can select **All configurations** and **All platforms** and then verify that the paths are correct.
30+
If you run your builds outside of the Visual Studio IDE, and your builds are succeeding but IntelliSense is incorrect, it's possible that your command line is out of sync with the project settings for one or more configurations. Right-click on the project node in **Solution Explorer** and make sure that all **#include** paths are correct for the current configuration and platform. If the paths are identical in all configurations and platforms, you can select **All configurations** and **All platforms** and then verify that the paths are correct.
3131

32-
![VC++ Include Directories](media/vcpp-intellisense-include-paths.png)
32+
:::image type="content" source="media/vcpp-intellisense-include-paths.png" alt-text="Screenshot that shows the Include Directories setting in the Configuration Properties section.":::
3333

34-
To see the current values for build macros such as **VC_IncludePath**, select the Include Directories line and click the dropdown on the right. Then choose **\<Edit>** and click on the **Macros** button.
34+
To see the current values for build macros such as **VC_IncludePath**, select the **Include Directories** dropdown. Then choose **\<Edit>** and select the **Macros** button.
3535

3636
### Makefile projects
3737

38-
For Makefile projects that are based on the NMake project template, choose **NMake** in the left pane and then choose **Include search path** under the **IntelliSense** category:
38+
For Makefile projects that are based on the NMake project template, choose **NMake** under **Configuration Properties**, and then choose **Include search path** in the **IntelliSense** category:
3939

40-
![Makefile project include paths](media/vcpp-intellisense-makefile-include-paths.png)
40+
:::image type="content" source="media/vcpp-intellisense-makefile-include-paths.png" alt-text="Screenshot that shows the Include Search Path setting under Intellisense.":::
4141

42-
### Open Folder projects
42+
### CMake projects
4343

44-
For CMake projects, make sure that #include paths are specified correctly for all configurations in CMakeLists.txt. Other project types might require a CppProperties.json file. For more information, see [Configure IntelliSense with CppProperties.json](/cpp/build/open-folder-projects-cpp#configure-code-navigation-with-cpppropertiesjson). Make sure that the paths are correct for each configuration that is defined in the file.
44+
For CMake projects, make sure that #include paths are specified correctly for all configurations in *`CMakeLists.txt`*. Other project types might require a *`CppProperties.json`* file. For more information, see [Configure code navigation with CppProperties.json](/cpp/build/open-folder-projects-cpp#configure-code-navigation-with-cpppropertiesjson). Make sure that the paths are correct for each configuration that is defined in the file.
4545

46-
If there is a syntax error in the CppProperties.json file, IntelliSense in the affected files will be incorrect. Visual Studio will display the error in the Output Window.
46+
If there's a syntax error in the *`CppProperties.json`* file, IntelliSense in the affected files is incorrect. Visual Studio displays the error in the Output Window.
4747

4848
## Tag parser issues
4949

50-
The tag parser is a "fuzzy" C++ parser that is used for browsing and navigation. It is very fast but does not attempt to completely comprehend every code construct.
50+
The tag parser is a *fuzzy* C++ parser that's used for browsing and navigation. It's fast but doesn't attempt to completely comprehend every code construct.
5151

52-
For example, it doesnt evaluate preprocessor macros, and therefore it may incorrectly parse code that makes heavy use of them. When the Tag Parser encounters an unfamiliar code construct, it may skip that entire region of code.
52+
For example, it doesn't evaluate preprocessor macros, and therefore it might incorrectly parse code that makes heavy use of them. When the Tag Parser encounters an unfamiliar code construct, it might skip that entire region of code.
5353

5454
There are two common ways in which this problem manifests in Visual Studio:
5555

56-
1. If the Navigation Bar shows an innermost macro, then the current function definition was skipped:
56+
1. If the navigation bar shows an innermost macro, then the current function definition was skipped:
5757

58-
![Tag parser skips function definition](media/vcpp-intellisense-tag-parser-macro.png)
58+
:::image type="content" source="media/vcpp-intellisense-tag-parser-macro.png" alt-text="Screenshot that shows the tag parser skipping the function definition.":::
5959

6060
1. The IDE offers to create a function definition for a function that is already defined:
6161

62-
![Tag parser offers to define existing function](media/vcpp-intellisense-tag-parser-function.png)
62+
:::image type="content" source="media/vcpp-intellisense-tag-parser-function.png" alt-text="Screenshot that shows the tag parser offering to define an existing function.":::
6363

64-
To fix these kinds of problems, add a file named **cpp.hint** to the root of your solution directory. For more information, see [Hint Files](/cpp/build/reference/hint-files).
64+
To fix these kinds of problems, add a file named *`cpp.hint`* to the root of your solution directory. For more information, see [Hint Files](/cpp/build/reference/hint-files).
6565

6666
Tag parser errors appear in the **Error List** window.
6767

6868
## Validate project settings with diagnostic logging
6969

70-
To check whether IntelliSense compiler is using correct compiler options, including Include Paths and Preprocessor macros, turn on Diagnostic Logging of IntelliSense command lines in **Tools > Options > Text Editor > C/C++ > Advanced > Diagnostic Logging**. Set **Enable Logging** to True, **Logging Level** to 5 (most verbose), and **Logging Filter** to 8 (IntelliSense logging).
70+
To check whether the IntelliSense compiler is using correct compiler options, including Include Paths and Preprocessor macros, turn on Diagnostic Logging of IntelliSense command lines in **Tools > Options > Text Editor > C/C++ > Advanced > Diagnostic Logging**. Set **Enable Logging** to True, **Logging Level** to 5 (most verbose), and **Logging Filter** to 8 (IntelliSense logging).
7171

72-
The Output Window will now show the command lines that are passed to the IntelliSense compiler. Here is a sample output:
72+
The Output Window now shows the command lines that are passed to the IntelliSense compiler. Here's a sample output:
7373

7474
```output
7575
[IntelliSense] Configuration Name: Debug|Win32
@@ -86,19 +86,19 @@ The Output Window will now show the command lines that are passed to the Intelli
8686
/Yustdafx.h
8787
```
8888

89-
This information may help you understand why IntelliSense is providing inaccurate information. For example, if your projects Include directory contains **$(MyVariable)\Include**, and the diagnostic log shows **/I\Include** as an Include path, it means that **$(MyVariable)** wasnt evaluated, and was removed from the final include path.
89+
This information might help you understand why IntelliSense is providing inaccurate information. For example, if your project's Include directory contains `$(MyVariable)\Include`, and the diagnostic log shows `/I\Include` as an Include path, it means that `$(MyVariable)` wasn't evaluated, and was removed from the final include path.
9090

9191
## About the IntelliSense build
9292

9393
Visual Studio uses a dedicated C++ compiler to create and maintain the database that powers all the IntelliSense features. To keep the IntelliSense database in sync with the code, Visual Studio automatically launches IntelliSense-only builds as background tasks in response to certain changes made in the project settings or source files.
9494

95-
However, in some cases Visual Studio might not update the IntelliSense database in a timely manner. For example, when you run a **git pull** or **git checkout** command, Visual Studio might take up to an hour to detect changes in the files. You can force a rescan of all files in a solution by right-clicking on the project node in **Solution Explorer** and choosing **Rescan Solution**.
95+
However, in some cases Visual Studio might not update the IntelliSense database in a timely manner. For example, when you run a `git pull` or `git checkout` command, Visual Studio might take up to an hour to detect changes in the files. You can force a rescan of all files in a solution by right-clicking on the project node in **Solution Explorer** and choosing **Rescan Solution**.
9696

97-
## Troubleshooting IntelliSense build failures
97+
## Troubleshoot IntelliSense build failures
9898

99-
An IntelliSense build does not produce binaries, but it can still fail. One possible cause for failure is custom .props or .targets files. In Visual Studio 2017 version 15.6 and later, IntelliSense-only build errors are logged to the Output window. To see them, set **Show output from** to **Solution**:
99+
An IntelliSense build doesn't produce binaries, but it can still fail. One possible cause for failure is custom *`.props`* or *`.targets`* files. In Visual Studio 2017 version 15.6 and later, IntelliSense-only build errors are logged to the Output window. To see them, set **Show output from** to **Solution**:
100100

101-
![Output window for solution errors](media/vcpp-intellisense-output-window.png)
101+
:::image type="content" source="media/visual-cpp-intellisense-output-window.png" alt-text="Screenshot that shows the Output window for solution errors.":::
102102

103103
The error message might instruct you to enable design-time tracing:
104104

@@ -109,10 +109,10 @@ Set environment variable TRACEDESIGNTIME=true and restart
109109
Visual Studio to investigate.
110110
```
111111

112-
If you set the environment variable TRACEDESIGNTIME to true and restart Visual Studio, you will see a log file in the %TEMP% directory, which might help diagnose the build failure.
112+
If you set the environment variable `TRACEDESIGNTIME` to true and restart Visual Studio, you see a log file in the *`%TEMP%`* directory, which might help diagnose the build failure.
113113

114-
To learn more about TRACEDESIGNTIME environment variable, see [Roslyn](https://github.com/dotnet/roslyn/blob/main/docs/wiki/Diagnosing-Project-System-Build-Errors.md) and [Common Project System](https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md). The information in these articles is relevant for C++ projects.
114+
To learn more about `TRACEDESIGNTIME` environment variable, see [Roslyn](https://github.com/dotnet/roslyn/blob/main/docs/wiki/Diagnosing-Project-System-Build-Errors.md) and [Design-time builds](https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md). The information in these articles is relevant for C++ projects.
115115

116116
## Related content
117117

118-
- [Visual C++ IntelliSense](visual-cpp-intellisense.md)
118+
- [Visual C++ IntelliSense features](visual-cpp-intellisense.md)

0 commit comments

Comments
 (0)