wxCHECK_VERSION
wxCHECK_GCC_VERSION
wxCHECK_W32API_VERSION
Version macros
Contents Up Previous Next

Version macros

The following constants are defined in wxWindows:

For example, the values or these constants for wxWindows 2.1.15 are 2, 1 and 15.

Additionally, wxVERSION_STRING is a user-readable string containing the full wxWindows version and wxVERSION_NUMBER is a combination of the three version numbers above: for 2.1.15, it is 2115 and it is 2200 for wxWindows 2.2.

Include files

<wx/version.h> or <wx/defs.h>


wxCHECK_VERSION

bool wxCHECK_VERSION(major, minor, release)

This is a macro which evaluates to true if the current wxWindows version is at least major.minor.release.

For example, to test if the program is compiled with wxWindows 2.2 or higher, the following can be done:

    wxString s;
#if wxCHECK_VERSION(2, 2, 0)
    if ( s.StartsWith("foo") )
#else // replacement code for old version
    if ( strncmp(s, "foo", 3) == 0 )
#endif
    {
        ...
    }

wxCHECK_GCC_VERSION

bool wxCHECK_GCC_VERSION(major, minor, release)

Returns 1 if the compiler being used to compile the code is GNU C++ compiler (g++) version major.minor.release or greater. Otherwise, and also if the compiler is not GNU C++ at all, returns 0.


wxCHECK_W32API_VERSION

bool wxCHECK_GCC_VERSION(major, minor, release)

Returns 1 if the version of w32api headers used is major.minor.release or greater. Otherwise, and also if we are not compiling with mingw32/cygwin under Win32 at all, returns 0.