Delphi Ifdef

Other answers have pointed you at the places to define symbols and the scope implications of the different approaches. However, what no-one has yet mentioned is that if you change the DEFINE symbols you MUST do a FULL BUILD of your project for them to have any effect on your code. When you 'Compile' the Delphi compiler will only compile units which have themselves changed since the previous compile. If you change DEFINE symbols this doesn't change any project units, so if the units are not re-compiled then the change in DEFINE symbols will not have ANY effect in those units. To FORCE changes in DEFINE symbols to be applied in ALL units, you MUST 'build', not compile.

O Can someone say me what are all the VERxxx since delphi 1, sub versions included? O Or can some one replace the xxx by the good versions in the following?

Delphi Ifdef

This may explain why your attempt to set defines did not appear to work previously. There are two places where you can put conditional defines that are used in all units of a project: • in the project options (as David Heffernan already said) • in an include file that is included in all of these units Why do I mention the second option? Because it allows specialized processing based on the VERxxx conditional define and other conditional defines given in 1. See jedi.inc (from the Jedi JCL) for an example. Also, as Deltics said: When it determines which units to recompile, the compiler only checks whether the unit itself has changed, not whether the conditional defines or any include files have changed.

Delphi

Delphi Ifdef 64 Bit

So if you change conditional defines, you must do a rebuild, not just a recompile. Since the Delphi compiler is very fast, this fortunately does not make much of a difference for compile times.

Delphi Ifdef Android

Form X and FormY has the same name in Delphi - Let's say MyForm. In other words, If I have a button on the main form of the project, I want to say MyForm.DoSomething on the button's onclick event. Depending on what conditional directive I specify, I want either formX.DoSomething, or FormY.DoSomething to be executed. Trying to make Delphi more C#-like is a mistake. Just think how the attributes syntax in modern Delphi is not pascal-oriented: it should be defined after the type definition, as in the free pascal syntax, not before it, as in C#/Java.