2
votes

I work in a Project Group composed by 3 projects with common units.

in project 1, i wrote in the project source :

program Project1;
{$DEFINE FIRSTPROJECT}
uses
  .....

in project 2, i wrote in the project source :

program Project2;
{$DEFINE SECONDPROJECT}
uses
  .....

Then in the differents units code i wrote :

...
{$IFDEF FIRSTPROJECT}
do this
{$ELSE}
do that
{$ENDIF}
...

The first project code is never compiled (it's just ignore). But if i put the {$DEFINE FIRSTPROJET} in same unit then it work... (in Delphi2009).

How can i spread my compilation directive threw all the file used ? Just depending on which project i want to compile...

1

1 Answers

1
votes

$DEFINE directives are local to the unit in which they are defined. If you place them in a project source file, a .dpr file, then they apply in that .dpr file only.

You need to add the conditional defines to each of your projects by using the Project Options dialog.