Pre-defined Library Macros

Table of Content - Compilers

Table of Content - Compilers
Standard C Libraries
GNU glibc
VMS libc
uClibc
z/OS libc
Standard C++ Libraries
Dinkumware
GNU libstdc++
Intel C++ Run-Time Libraries
Other Libraries
Microsoft Foundation Classes

Standard C Libraries

GNU glibc

The following macros have to be included from <features.h>.

Type Macro Description
Version __GNU_LIBRARY__
__GNU_LIBRARY_MINOR__
Until version 5
Version __GLIBC__
__GLIBC_MINOR__
From version 6

Official site Google Directory Wikipedia

VMS libc

Type Macro Format Description
Identification __CRTL_VER . .
Version __CRTL_VER VVRREPPTT VV = Version
RR = Revision
E = Edit number
PP = Patch (01 = A, ... 26 = Z)
TT = Type (22 = official)

Please note that I am not sure about the format of __CRTL_VER, but it seems to follow that of __VMS_VER.

uClibc

Type Macro Description
Identification __UCLIBC__ .
Version __UCLIBC_MAJOR__ Version
Version __UCLIBC_MINOR__ Revision
Version __UCLIBC_SUBLEVEL__ Patch

Official site Wikipedia

z/OS libc

Type Macro Format Description
Identification __LIBREL__ . Host
Identification __TARGET_LIB__ . Target
Version __LIBREL__ 0xNVRRPPPP N = Product (0 = C/370, 1 = MVS, 2 = OS/390, 4 = z/OS)
V = Version
RR = Revision
PPPP = Patch

Defined for z/OS XL C/C++
Version __TARGET_LIB__ As above .

Library __LIBREL__
OS/390 2.10 0x220A0000
z/OS 1.1 0x41010000
z/OS 1.6 0x41060000

Standard C++ Libraries

Dinkumware

Type Macro Format Description
Identification __CPPLIB_VER . .
Version __CPPLIB_VER VVRR VV = Version
RR = Revision

Dinkumware __CPPLIB_VER
3.08 308

Official site

GNU libstdc++

Type Macro Format Description
Version __GLIBCPP__ YYYYMMDD YYYY = Year
MM = Month
DD = Day

Until GCC 3.4.0
Version __GLIBCXX__ YYYYMMDD YYYY = Year
MM = Month
DD = Day

From GCC 3.4.0

GCC __GLIBCPP__ __GLIBCXX__
3.0.0 20010615 .
3.1.0 20020514 .
3.2.0 20020814 .
3.3.0 20030513 .
3.4.0 . 20040419

Official site

Intel C++ Run-Time Libraries

Type Macro
Identification __INTEL_CXXLIB_ICC

Other Libraries

Microsoft Foundation Classes

Type Macro Format Description
Identification _MFC_VER . .
Version _MFC_VER 0xVVRR VV = Version
RR = Revision

MFC _MFC_VER
4.21 0x0421
6.0 0x0600
7.0 0x0700

Official site Google Directory Wikipedia