Contents Up Previous Next

Version macros

The following constants are defined in wxWidgets:

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

Additionally, wxVERSION_STRING is a user-readable string containing the full wxWidgets 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 wxWidgets 2.2.

The subrelease number is only used for the sources in between official releases and so normally is not useful.

Include files

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

wxCHECK_GCC_VERSION
wxCHECK_VERSION
wxCHECK_VERSION_FULL
wxCHECK_W32API_VERSION


wxCHECK_GCC_VERSION

bool wxCHECK_GCC_VERSION(major, minor)

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


wxCHECK_VERSION

bool wxCHECK_VERSION(major, minor, release)

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

For example, to test if the program is compiled with wxWidgets 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_VERSION_FULL

bool wxCHECK_VERSION_FULL(major, minor, release, subrel)

Same as wxCHECK_VERSION but also checks that wxSUBRELEASE_NUMBER is at least subrel.


wxCHECK_W32API_VERSION

bool wxCHECK_W32API_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.