Adding GDI+ headers to MinGW (to compile wxWidgets with wxGraphicsContext support)

The GDI+ library is mandatory for wxGraphicsContext support on Win32. This is no problem if you’re using Visual C++, since the SDK provides the headers and import libraries, but for MinGW there are no such headers and import libraries provided. But there are some sources on the internet where you can get the necessary files.

Elaborate instructions to convert files from the Visual C++ SDK for MinGW usage can be found @ http://wiki.bb4win.org/wiki/Using_GDIPlus_With_MinGW while here you can follow a discussion about an unsuccessful contribution to MinGW (and see what difficulties such projects have).

The most easiest solution seem to be the files provided by wxmax (BlitzMax bindings for wxWidgets) where a zip file containing headers and import library (already altered for MinGW usage) is available for download (local copy). Just copy the files from the “include” directory into C:\MinGW\include (or wherever your MinGW files are) and the file from the “lib” directory into C:\MinGW\lib.

This should be enough to so that MinGW can compile wxWidgets with GDI+ support, e.g.

cd %WXWIN%\build\msw
mingw32-make -f makefile.gcc BUILD=release SHARED=1 USE_GDIPLUS=1
set PATH=%WXWIN%\lib\gcc_dll;%PATH%
cd %WXWIN%\samples\drawing
mingw32-make -f makefile.gcc BUILD=release SHARED=1 USE_GDIPLUS=1
gcc_mswdll\drawing.exe

And voila!

5 thoughts on “Adding GDI+ headers to MinGW (to compile wxWidgets with wxGraphicsContext support)

  1. Thanks for the instructions. I used these headers to cross-compile wxWidgets on Linux (MinGW with GCC 4.4.4 from Ubuntu gcc-mingw32 package). I only needed to change the case of the filenames and remove extra-qualification in two places. Here is the patch: https://gist.github.com/894515

  2. Hello,
    I get following error, if I try to compile the gdiplus stuff in wxwidgets
    c/msw/graphics.cpp
    In file included from c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../in
    clude/gdiplus.h:56,
    from ../../src/msw/graphics.cpp:92:
    c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/GdiplusStringFor
    mat.h:220: error: extra qualification ‘Gdiplus::StringFormat::’ on member ‘GetTr
    imming’
    In file included from c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../in
    clude/gdiplus.h:59,
    from ../../src/msw/graphics.cpp:92:
    c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/GdiplusMetafile.
    h:353: error: extra qualification ‘Gdiplus::Metafile::’ on member ‘EmfToWmfBits’

  3. Thx for the headers zip!

    I tested it with tdm-mingw-1.908.0-4.4.1-2 and codeblocks 10.05

    required header files:

    #include
    #include
    #include
    #include
    #include

    #include
    ———————————-

    Two errors occured:

    GdiplusStringFormat.h|220|error: extra qualification ‘Gdiplus::StringFormat::’ on member ‘GetTrimming’|

    GdiplusMetafile.h|353|error: extra qualification ‘Gdiplus::Metafile::’ on member ‘EmfToWmfBits’|

    >>> Solution by

    josh.bia…, http://code.google.com/p/wxmax/issues/detail?id=25

    “The solution was to remove the class name prefix from
    the static method names in the two offending files.”

    late reply, but HTH others,
    shak-otay

  4. for some weird reason the names after #include were cut:
    unknwn.h, basetyps.h, rpc.h, rpcnsi.h, rpcndr.h
    gdiplus.h

    (yes, it’s ‘basetyps.h’, no typo)

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.