# Scanner Discovery Preferences

## General

Use the Discovery Tab on Build preference panel to define global scanner discovery options.

In the Discovery tab you can see a list of Language Settings Providers. Language Settings Providers supply Language Settings such as include paths and preprocessor macros for the indexer and other components of CDT.

A user can define some properties for global (or "shared") providers on this preference. Note that providers can be either shared or defined per configuration. Properties for non-shared providers can be defined in Project properties: Preprocessor Include Paths, Macros, etc.

Discovery tab
Group | Description
--- | ---
Language Settings Providers | Lists the available language settings providers.
Clear Entries | Click to clear all entries of the selected provider. This operation takes effect after pressing "Apply" or "OK". Normally this will trigger a rerun if the provider supplies built-in compiler settings. Build output parsers will regain language settings after build while parsing new build output. This operation might be unavailable if the provider does not have any language settings. Some providers may not have the capability to clear.
Reset | Click to reset options of the selected provider to default values. This operation also clears the provider entries. The button can be enabled if some options in "Language Settings Provider Options" panel were changed.

Kinds of Language Settings Providers
Provider | Description
Build Output Parser Provider | Build Output Parser Provider parses output of build looking for include paths and macros passed to the compiler via compiler options. Include files, macro files passed the the compiler and some other compiler options are normally also recognized. For gcc, include paths commonly passed with "-I" option and macros with "-D" option. The language settings found by BOP are available after the build is finished.
Builtin Compiler Settings Provider | Builtin Compiler Settings Provider launches the compiler with special options that instruct the compiler to print built-in settings such as include paths to internal system headers and the list of internally predefined macros. This provider is usually shared between projects in workspace and runs in background once. When it is finished the language settings are available to all the projects between which it is shared.
Managed Build Language Settings Provider | MBS Provider supplies language settings provided by Managed Build System.
User Language Settings Provider | A user has an opportunity to enter language settings manually using this provider. User Language Settings Provider should be normally the first in the list so these settings override settings supplied by other providers.
Contributed PathEntry Containers | This provider is here for backward compatibility support of PathEntry Containers from older versions of CDT. Using this method is not recommended.
Contributed ScannerInfo Entries | This provider is here for backward compatibility support of ScannerInfo Entries from older versions of CDT. Using this method is not recommended.

## Language Settings Providers Options

Language settings providers can have options that affect the behavior of a provider. These options are presented in "Language Settings Provider Options" panel.

### Build Output Parser Options

Build Output Parser Options
Provider | Options
Compiler command pattern | The pattern which is used to recognize compiler command in build output. Note that the pattern is Java regular expression pattern, it is NOT globbing pattern used to expand file name in command line.
Container to keep discovered entries | The discovered entries can be associated with the project, enclosing folder or the file itself.
Use heuristics to resolve paths | The provider will try to find the best match for the discovered path in the project or workspace trying several heuristics. If disabled, the discovered paths will stay as they appear in build output.

### Builtin Compiler Settings Provider Options

Builtin Compiler Settings Provider Options
Provider | Options
Command to get compiler specs | The command to make the compiler print built-in settings. Following variables are recognized: ${COMMAND} - compiler command from the toolchain, such as "gcc". ${INPUTS} - indicates normally an empty specs file required by the compiler. In no such file exists the file gets created temporarily in Eclipse workspace plugin area. ${EXT} - an extension for the language to discover built-in settings. A provider can be associated with multiple languages and it will run the command for each language.
Browse | Use this button to locate the compiler on the file system. The result is put into "Command to get compiler specs" input field.
Allocate console in the Console View | Enable to troubleshoot problems running the command. When enabled, output of each run of the provider will be directed to a special console in the Console View. See also Scanner Discovery - Console View.

To see the entries a provider discovered, go to project properties (or the properties of the resource of interest), see Project properties: Preprocessor Include Paths, Macros, etc.

A hint: After compiler upgrade re-discover changed settings with "Clear Entries" of the appropriate provider.

Scanner Discovery
C/C++ Indexer

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

C/C++ Project properties: Preprocessor Include Paths, Macros, etc.