[fpc-devel] Trouble with FPC version.

Florian Klaempfl florian at freepascal.org
Thu May 4 10:03:17 CEST 2006


Alexander Todorov wrote:
> Hello,
> I use a custom written defines set to determine the fpc version.
> 
> -----------------------------------------------------------------------------------------------------------------------------------
> 
> program project1;
> 
> {$mode objfpc}{$H+}
> 
> uses SysUtils;
> 
> // fpc 2.0.0
> {$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 0))}
>   {$DEFINE FPC_VER_200}
> {$ENDIF}
> 
> // fpc 2.0.1
> {$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 1))}
>   {$DEFINE FPC_VER_201}
> {$ENDIF}
> 
> // fpc >= 2.0.1
> {$IF ((FPC_VERSION >= 2) and (FPC_RELEASE >= 0) and (FPC_PATCH >= 1))}
>   {$DEFINE FPC_VER_201+}

This is assumed to be FPC_VER_201. + isn't a valid character for an id?
> {$ENDIF}
> 
> // fpc = 2.0.2
> {$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 2))}
>   {$DEFINE FPC_VER_202}
> {$ENDIF}
> 
> begin
>   {$IFDEF FPC_VER_200}
>   writeln('version 2.0.0');
>   {$ENDIF}
> 
>   {$IFDEF FPC_VER_201}
>   writeln('version 2.0.1');
>   {$ENDIF}
> 
>   {$IFDEF FPC_VER_201+}
>   writeln('version 2.0.1+');
>   {$ENDIF}
> 
>   {$IFDEF FPC_VER_202}
>   writeln('version 2.0.2');
>   {$ENDIF}
> end.
> ---------------------------------------------------------------------------------------------------------------------------------
> 
> the output from this is:
> version 2.0.1
> version 2.0.1+
> version 2.0.2
> 
> I am compiling with FPC 2.0.2. Is this a bug or I have wrong defines????
> I have to switch to VER2_0_1, VER2_0_2 compiler defines, but how to
> make a 2.0.1+ with those?
> 
> Thanks.
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list