Often it is necessary to determine which compiler is currently being used for a project. Particularly component developers face this requirement often if they don't want their creations only usable with one compiler. The include file offered here is to address this need by defining a number of compiler symbols, depending on the used compiler and platform, which in turn can then easily be tested to adjust the compilation of code blocks to a particular target compiler.

Supported are all Borland compilers, that is, any Delphi version from 1 up to 2005, Borland C++ Builder (1, 3-6) and Kylix (1-3). There are at least four symbols defined for each compiler. One is for the compiler family (e.g. DELPHI_7, for Delphi 7 or CPP_1 for Borland C++ Builder 1), one for this and all following compilers in a family (e.g. DELPHI_5_UP, for all Delphi versions beginning with Delphi 5) and finally two symbols for the common compiler generation (e.g. COMPILER_6 and COMPILER_6_UP, for any Delphi and BCB compiler including successors).

Under certain circumstances additional symbols will be defined. These are QT_CLX if Trolltech's Qt library is used and DELPHI.NET (DELPHI.NET_X, DELPHI.NET_X_UP) if any compiler with .NET support is compiling the source code.


Borland compiler detection include file is published under the MIT license. This license is very generous and allows use of the code in any application including commercial software.


For an example how to use this include file download any software package from this site. This file is used almost everywhere in my projects and if you already have installed one of my packages then you probably have Compilers.inc already on your hard drive. In order to avoid multiple copies on your machine I strongly recommend to keep only one copy of Compilers.inc in a central folder, which could then be included in the common search path.


Borland compiler determination include file
Download link: Borland compiler determination include file
Description: Include file defining compiler symbols for various Borland compilers.
Version: n/a
Last change: 03. Feb 2007
Download count: 15114
Package size: 2 KB
Author: Mike Lischke (www.soft-gems.net)
Platform: Delphi 5 - 7, 2005, BCB 5 - 6
Type of download: Application