If I can do this in Delphi,
{$IFDEF VER350}
/* Declare, define, do stuff ... */
{$ENDIF}
why can't I do this in C++Buider,
#ifdef VER350
// Declare, define, do stuff ...
#endif
How do I get the compiler version in C++Builder?
If I can do this in Delphi,
{$IFDEF VER350}
/* Declare, define, do stuff ... */
{$ENDIF}
why can't I do this in C++Buider,
#ifdef VER350
// Declare, define, do stuff ...
#endif
How do I get the compiler version in C++Builder?
Because the compiler doesn't define the same macro or do that kind of thing in the same way as Delphi.
According to this webpage, the macro you are looking for is called __BCPLUSPLUS__
and you have to check if it is equal to the version code you are looking for. See this page for the Delphi - C++ Builder equivalents.
However, the versioning is not quite as straight forward as in the case of Delphi and the table at the bottom of the page doesn't seem to have been updated to include the version of C++ Builder that corresponds to Delphi VER350. Still, it stands to reason that since the VER340 equivalent is listed as 0x0750
and the one before that was 0x0740
, then the latest is most likely 0x0760
. It is an easy check on your end in any case.
It would look something like
#if __BCPLUSPLUS__ == 0x0760
...
#endif