What is the compiler version for Delphi 2010?
Asked Answered
P

5

19

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"?

Porphyrin answered 2/9, 2009 at 17:51 Comment(3)
err yes... just a typo. thanksPorphyrin
see stackoverflow.com/questions/750801Kliber
Might be worth mentioning when looking for the version constants there's a big fancy chart in the embarcadero documentation for all the special compiler version numbers: docwiki.embarcadero.com/RADStudio/XE6/en/Compiler_VersionsStaffordshire
L
17

{$IFDEF VER210}

Lello answered 3/9, 2009 at 3:18 Comment(3)
This file almost always contains the latest defines: jcl.svn.sourceforge.net/viewvc/jcl/trunk/jcl/source/include/…Displayed
@JeroenWiertPluimers, link is dead.Diarmit
@ToonKrijthe JCL/JEDI moved from SF to GitHub a while ago. This is the one that hupefully won't move for a long time and contains all versions from Delphi 1 until the most recently released version (sometimes including the version currently in beta), including Kylix and FreePascal: github.com/project-jedi/jedi/blob/master/jedi.incDisplayed
P
58

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).

Porphyrin answered 3/9, 2009 at 12:57 Comment(3)
The thing between 2006 and 2007 is that the compiler in 2007 used the same DCU format, so people's components would still work.Carlile
Would someone add Delphi XE3 to this list ? I'm guessing its VER240 ?Pedant
I have added XE6 and XE7Vasta
T
32

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
Thynne answered 15/10, 2009 at 12:50 Comment(4)
I have added compiler versions for recent Delphi (XE3..XE7)Vasta
Please, add XE8 (29), RAD 10 Seattle (30) and RAD 10.1 Berlin (31)Inflame
Value of CompilerVersion constant is same that is in the VER### define!Paronym
docwiki.embarcadero.com/RADStudio/en/Compiler_Versions now contains both defines and this constant values for all versionsParonym
L
17

{$IFDEF VER210}

Lello answered 3/9, 2009 at 3:18 Comment(3)
This file almost always contains the latest defines: jcl.svn.sourceforge.net/viewvc/jcl/trunk/jcl/source/include/…Displayed
@JeroenWiertPluimers, link is dead.Diarmit
@ToonKrijthe JCL/JEDI moved from SF to GitHub a while ago. This is the one that hupefully won't move for a long time and contains all versions from Delphi 1 until the most recently released version (sometimes including the version currently in beta), including Kylix and FreePascal: github.com/project-jedi/jedi/blob/master/jedi.incDisplayed
F
9

Here is a wiki page with conditional defines.

Fritts answered 15/10, 2009 at 13:24 Comment(0)
A
1

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}
Aracelyaraceous answered 25/1, 2011 at 21:19 Comment(2)
If the reason for conditional compilation is Unicode or lack thereof, use {$IFDEF UNICODE}.Gynandrous
So long as you are supporting only Delphi 6+. Before Delphi 6 there is not {$IF}Staffordshire

© 2022 - 2024 — McMap. All rights reserved.