This is a scenario better suited to the more powerful $IF
than the rather limited $IFDEF
.
uses
Dialogs, Forms, SysUtils,
{$IF Defined(SETTINGSREG)}
U_SettingsConnReg,
{$ELSEIF Defined(SETTINGSXML)}
U_SettingsConnXml,
{$ELSE}
U_SettingsConnIni,
{$IFEND}
U_SectionNames;
In the latest versions of Delphi you can use $ENDIF
here rather than $IFEND
if you prefer.
If you want to fail if no conditional is defined, you can do this:
uses
Dialogs, Forms, SysUtils,
{$IF Defined(SETTINGSREG)}
U_SettingsConnReg,
{$ELSEIF Defined(SETTINGSXML)}
U_SettingsConnXml,
{$ELSEIF Defined(SETTINGSINI)}
U_SettingsConnIni,
{$ELSE}
{$Message Fatal 'Settings file format conditional must be defined'}
{$IFEND}
U_SectionNames;