[fpc-pascal] How to do conditional compilation with macros
Reinier Olislagers
reinierolislagers at gmail.com
Sun Sep 18 13:59:33 CEST 2011
On 18-9-2011 13:41, Sven Barth wrote:
> On 18.09.2011 13:29, Reinier Olislagers wrote:
>> What am I doing wrong?
>
> Additionally to what Marco wrote:
>
> You must not use the "$" as prefix for the "variable" if you reference
> such a compiler define inside an $if or $ifdef.
>
> Regards,
> Sven
Thanks guys - reading manuals is not always my strong point ;)
This works:
program conditional;
{$mode objfpc}{$H+}
begin
{$IF FPC_FULLVERSION > 20200}
//apparently FPC_FULLVERSION was introduced
//in FPC 2.2.4 though...
//http://delphi.wikia.com/wiki/FreePascal_detection_and_versioning
writeln('Version newer than 2.2');
{$ENDIF}
end.
More information about the fpc-pascal
mailing list