c++winapivisual-c++gdi+

#include <gdiplus.h> causes error


When I include gdiplus.h in a program that compiles well the first(there are many) error I get is:

c:\program files (x86)\microsoft sdks\windows\v7.0a\include\GdiplusImaging.h(77): error C2504: 'IUnknown' : base class undefined

Part of GdiplusImaging.h:

IImageBytes : public IUnknown  <<< error!
{
public:
     ...

Why it is so? Where is this IUnknown class? And why it's not in GdiplusImaging.h?

My system is Windows7 x64. VisualStudio 2010.

Including part:

#include <windows.h>
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment (lib, "gdiplus.lib")

Solution

  • These are the standard includes for using GDI+:

    #include <windows.h>
    #include <objidl.h>
    #include <gdiplus.h>
    using namespace Gdiplus;
    #pragma comment (lib,"Gdiplus.lib")