Do you mean that I have to use MinGW-w64's gcc 8.1 and above?
I have only gcc 7.2 at hand.
You have to use a compiler which has the direct2d headers/libs or you have to manually comment the enforcing code in local builds.
I'm using mingw810_64seh> gcc.exe --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Could you please tell us what we have to do to get around this problem.
I don't understand the comment above. What does "comment the enforcing code" mean? And where would that be?
The setup.h for wxWidgets 3.1.1 here is:
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a compiler without support for GDI+
// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are
// known to have them). For other compilers (e.g. older mingw32) you may need
// to install the headers (and just the headers) yourself. If you do, change
// the setting below manually.
//
// Recommended setting: 1 if supported by the compilation environment
// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION()
// here as this file is included from wx/platform.h before they're defined.
#if defined(_MSC_VER) || \
(defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8))
#define wxUSE_GRAPHICS_CONTEXT 1
#else
// Disable support for other Windows compilers, enable it if your compiler
// comes with new enough SDK or you installed the headers manually.
//
// Notice that this will be set by configure under non-Windows platforms
// anyhow so the value there is not important.
#define wxUSE_GRAPHICS_CONTEXT 0
#endif
...further down....
/* --- end common options --- */
/* --- start MSW options --- */
// ----------------------------------------------------------------------------
// Graphics backends choices for Windows
// ----------------------------------------------------------------------------
// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1.
// Enable support for GDI+-based implementation of wxGraphicsContext.
//
// Default is 1.
//
// Recommended setting: 1 if you need to support XP, as Direct2D is not
// available there.
#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT
// Enable support for Direct2D-based implementation of wxGraphicsContext.
//
// Default is 1 for compilers which support it, i.e. VC10+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
//
// Recommended setting: 1 for faster and better quality graphics under Windows
// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier
// systems will fall back on using GDI+).
#if defined(_MSC_VER) && _MSC_VER >= 1600
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
#define wxUSE_GRAPHICS_DIRECT2D 0
#endif
But I still get the problem.