In Delphi 2010, if I want to do this:
{$IFDEF VER999}
//some delphi 2010-specific code here
{$ENDIF}
What version # do I need to use in place of "999"?
In Delphi 2010, if I want to do this:
{$IFDEF VER999}
//some delphi 2010-specific code here
{$ENDIF}
What version # do I need to use in place of "999"?
{$IFDEF VER210}
Here's the list of compiler versions:
{$IFDEF VER40} - Turbo pascal 4
{$IFDEF VER50} - Turbo pascal 5
{$IFDEF VER55} - Turbo pascal 5.5
{$IFDEF VER60} - Turbo pascal 6
{$IFDEF VER70} - Borland pascal 7 (And turbo pascal 1.5 for windows)
{$IFDEF VER80} - Delphi 1
{$IFDEF VER90} - Delphi 2
{$IFDEF VER100} - Delphi 3
{$IFDEF VER120} - Delphi 4
{$IFDEF VER130} - Delphi 5
{$IFDEF VER140} - Delphi 6
{$IFDEF VER150} - Delphi 7
{$IFDEF VER160} - Delphi 8
{$IFDEF VER170} - Delphi 2005
{$IFDEF VER180} - Delphi 2006
{$IFDEF VER180} - Delphi 2007
{$IFDEF VER185} - Delphi 2007
{$IFDEF VER200} - Delphi 2009
{$IFDEF VER210} - Delphi 2010
{$IFDEF VER220} - Delphi XE
{$IFDEF VER230} - Delphi XE2
{$IFDEF VER240} - Delphi XE3
{$IFDEF VER250} - Delphi XE4
{$IFDEF VER260} - Delphi XE5
{$IFDEF VER265} - Appmethod 1.0
{$IFDEF VER270} - Delphi XE6
{$IFDEF VER280} - Delphi XE7
{$IFDEF VER290} - Delphi XE8
{$IFDEF VER300} - Delphi 10 Seattle
{$IFDEF VER310} - Delphi 10.1 Berlin
{$IFDEF VER320} - Delphi 10.2 Tokyo
In Delphi 2007, VER180
and VER185
are both defined. This was for backward compatibility with Delphi 2006, and to make sure you could also detect D2007 specifically.
I'm not sure why they did that between '06 and '07, but not for other releases. Seems inconsistent to me (but it isn't - see Barry Kelly's comment below).
If you're working with Delphi 6 and later, you can use CompilerVersion
:
{$IF CompilerVersion >= 18.5}
//some code only compiled for Delphi 2007 and later
{$IFEND}
Delphi 10.2 Tokyo - 32 Delphi 10.1 Berlin - 31 Delphi 10 Seattle - 30 Delphi XE8 - 29 Delphi XE7 - 28 Delphi XE6 - 27 Appmethod 1.0 - 26.5 Delphi XE5 - 26 Delphi XE4 - 25 Delphi XE3 - 24 Delphi XE2 - 23 Delphi XE - 22 Delphi 2010 - 21 Delphi 2009 - 20 Delphi 2007 - 18.5 Delphi 2006 - 18 Delphi 2005 - 17 Delphi 8 - 16 Delphi 7 - 15 Delphi 6 - 14
{$IFDEF VER210}
Along the same lines as Jason's comment if you are creating code that needs to run in current and older versions of Delphi you might want to do something like:
{$IF CompilerVersion > 18.5}
//Delphi 2009 or higher
//Unicode version of code
{$ELSE}
//Delphi 2007 and earlier
//NON-Unicode version of code
{$IFEND}
{$IFDEF UNICODE}
. –
Gynandrous © 2022 - 2024 — McMap. All rights reserved.