# Configure Compilers Dialogue Box

This dialogue box is used to let CodeSnip know about the Pascal Compilers that are installed on the system. It is displayed using the Tools | Configure Compilers menu option. CodeSnip uses these compilers when test compiling snippets.

When using the standard version of CodeSnip each logged on user has their own compiler configuration, so any changes you make will not affect other users. The portable edition of CodeSnip only supports one set of configuration data per installation.

Supported compilers are listed on the left hand side of the dialogue. If a compiler is known to CodeSnip its name appears in bold. Unknown compilers (or compilers that are not installed on the local system) appear in plain text.

Selecting a compiler on the left displays information about it on the right hand side of the dialogue. Here you enter or edit the required information on four or five tabs, as follows.

## Compiler Tab

### Compiler file name

Enter the the full path to the compiler's executable file in the Enter compiler executable file name edit box. This must be file name of the command line version of the compiler - for example Delphi's DCC32.exe. If you prefer you can select the file name from a standard file dialogue by clicking the ellipsis button to the right of the edit box. The chosen file name is entered in the edit box. As soon as the cursor leaves the edit box the file name is checked for validity – it must exist and be an executable file. If it is valid the compiler name will be emboldened.

Pressing the Clear button removes the compiler by deleting the path to its executable file. The Enter compiler executable file name edit box is cleared.

### Display compiler results

You can choose whether the compiler is included in the table of compile results displayed in the Details Pane. This is done using the Display results for this compiler in details pane check box. Tick the box to display the compiler's results or clear it to hide them.

Important Note: The facility to switch off the display of results for selected compilers was designed to limit the number of compilers whose results are displayed to avoid cluttering the Details Pane with unnecessary information. The feature should not be used to switch off the display of all compilers: doing that will cause a warning message to be displayed in place of the compiler results table. To switch off compiler results completely you should use the Snippet Layout page of the Preferences dialogue box to remove the Compiler Results Table component from the different kinds of snippet pages.

### Automatic compiler detection & registration

By default CodeSnip will automatically detect and register installed Delphi compilers for use with the program. This can happen in two ways:

1. When the Detect Delphi Compilers button is clicked (see below).
2. Optionally, when the program starts up.

You can prevent a specific Delphi compiler from being automatically registered by clearing the Permit auto-detection & registration of this compiler check box.

Note: This check box does not appear when the Free Pascal compiler is selected.

## Switches Tab

CodeSnip passes certain switches to the command line of each supported compiler. You can edit these switches if you wish the compilers to perform differently. You can add, delete or edit switches as follows:

- Add a switch. Enter its name in the edit box and click Add.
- Delete a switch. Select the switch in the list box the click the Delete button.
- Edit a switch. Select the switch in the list box to copy it to the edit box. Change the switch and click Replace.
- Restore default switches. Click the Defaults button. This can be useful if you have made some changes to switches and CodeSnip ceases to function properly.

For an explanation of the purpose of the switches please see your compiler's documentation.

Notes:

1. There is no need to use this tab to provide switches to set the compiler search path – that is very cumbersome. Instead you can use the Search Paths tab to define your search paths and to generate the correct switches automatically.
2. Similarly, when you have selected the Delphi XE2 or later compiler, there is no need to set up the `-NS` switch to specify the namespaces to search for various units. The Namespaces tab can be used to make this task simpler and to generate the correct `-NS` switch.

Warning: You should not remove any switches that cause the compilers to generate warnings and error messages since CodeSnip will not detect compilation errors correctly without these switches. You are strongly recommended not to pass any switches that alter the compiler's output otherwise CodeSnip may fail to operate correctly.

## Namespaces Tab

Note: This tab appears only if the selected compiler is Delphi XE2 or later.

Delphi XE2 or later qualify units from the RTL and VCL are prefixed with the name of the unit's namespace. Much of the code managed by CodeSnip uses unqualified unit names for reasons of backward compatibility. In order for the unqualified units to be found on Delphi XE2 and later the compiler has to be given a list of namespaces to search for the units.

This tab enables you to configure such a namespace, as follows:

- Add a namespace. Enter its name in the edit box and click Add.
- Delete a namespace. Select the namespaces in the list box the click the Delete button.
- Edit a namespace. Select the namespace in the list box to copy it to the edit box. Change the namespace name and click Replace.
- Restore default namespaces. Click the Defaults button. This can be useful if you have made some changes to namespaces and CodeSnip fails to compile snippets correctly. The default namespaces have been chosen because they contain the most commonly used units. Note: New releases of CodeSnip may change the default namespaces. Should this happen after you have customised the namespaces you will need to use the Defaults button to force the program to recognise the new default settings.

For a list of RTL and VCL units, and the namespaces to which they belong, see your compiler's documentation.

## Search Paths Tab

If you have your own or third party units you want your user-defined routines to reference you need to tell the compilers where to find them. This tab lets you do just that. Because you often use different versions of the same unit for different compilers, you must set up each compiler's search path separately.

The Existing Paths list displays any current search paths. You edit the search paths as follows:

- Add a path. Enter the required directory in the Add or edit path edit box then click Add. You can browse for the directory using a standard Browse For Folders dialogue box by clicking the ellipsis button to the right of the edit control.
- Edit an existing path. Select the directory in the list box. This copies the directory name to the edit control. Modify the name then click Replace.
- Delete a path. Select the directory in the list box and press Delete.
- Change the order of the search paths. Select a directory in the list box then move it up and down the list using the buttons that display the up and down arrows. Ctrl+Up and Ctrl+Down have the same effect.

## Output Log Tab

CodeSnip logs and examines the output of the compiler to determine if the compilation was clean or contained warnings. It also examines the output for error messages when the compilation fails. A summary of the logged output can be displayed by the user when warnings or errors occur. Instead of displaying the whole log the program filters out the required messages. It does this by looking for some common text that precedes the messages in the log. These prefixes are listed in the Log Prefixes editor.

If you are using an English language version of a compiler the default values will be correct. For all Delphis and Free Pascal the default values are:

- For fatal errors: "Fatal: "
- For general errors: "Error: "
- For warnings: "Warning: "

For languages other than English you need to compile some code that generates warnings, errors and fatal errors then check what text precedes each kind of message. This text should be entered in the Log Prefixes editor. Failure to do this will mean that CodeSnip won't detect warnings and won't report errors correctly.

## Auto Detecting Compilers

CodeSnip can automatically detect the presence of Win 32 Delphi compilers from Delphi 2 to Delphi 12 Athens. Click the Detect Delphi Compilers button to do this. Any supported installed version of Delphi will be recorded†. This can save considerable time and avoid errors.

Free Pascal cannot be detected automatically and must be configured manually.

If the Automatically register newly installed Delphi compilers at program startup check box is ticked then, when it starts up, CodeSnip will attempt to register any known Delphi compiler that is not yet registered with Delphi†.

† Any version of Delphi for which the Permit auto-detection & registration of this compiler check box is cleared will not be recorded.