Setting up include paths and macros for C/C++ indexer

CDT allows for comfortable environment with code highlighting, navigation, content assist and static analysis. However, most C/C++ projects have to be configured to enjoy those features. Most real life C/C++ projects heavily depend on code outside of the project itself, such as system headers or third party libraries. CDT indexer needs to process those to provide accurate index. Failure to set up these important settings assuredly will cause the assist tools misbehave.

CDT will try to discover include paths and preprocessor symbols automatically for supported toolchains. This process is known as Scanner Discovery or Autodiscovery. This discovery of symbols is twofold. One way, CDT will try to detect built-in compiler symbols and include paths running the compiler with special options and parse the output. Another method that CDT employs is to analyze build output of the regular build with Build Output Parser. Often, include paths are supplied to the compiler with -I options, and macros with -D options. That relies on verbose build output of your build where all these options are actually printed by make.

Scanner Discovery uses Language Settings Providers to find include paths and preprocessor symbols. Language Settings Providers can be configured on project properties page "Preprocessor Include Paths, Macros, etc.", Providers tab for a configuration and on preference page C/C++ Preferences: Scanner Discovery for shared providers.

If information retrieved by auto-discovery is insufficient or the project deviates from a standard one supported by CDT a user can inspect discovered entries and enter additional include paths and macros manually on the property page "Preprocessor Include Paths, Macros, etc.", Entries tab.

There are other ways to make C/C++ indexer aware of include paths or macros. One way is to set up them in MBS via "Paths and Symbols" project properties. See Including paths and symbols in Managed Build System. These entries are supplied to the indexer with MBS Language Settings Provider.

Related concepts
Scanner Discovery
C/C++ Indexer

Related tasks
Searching for C/C++ elements

Related reference
C/C++ Preferences: Scanner Discovery
C/C++ Project properties: Preprocessor Include Paths, Macros, etc.