Apparently olectl.h is not meant to be included alone (like
many other Win32 API headers). A quick search shows that
olectl.h is included by ocidl.h, but after ole2.h. The
mostly likely thing to work on all Windows compilers is to
just include windows.h.
However, this might still be a minor bug because MSVC
olectl.h includes ocidl.h, which is the reverse of Mingw. I
haven't used OLE so I can't say anything more definitive.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
windows.h does not include the olectl header; nor does it
include ole2 or oaidl -- windows.h was already included
before olectl.h in my program.
I've confirmed that the error does not occur if I include
ocidl instead of olectl, or include ole2 before I include
olectl.
I grokked the Mingw ole2.h to see what it was doing that
olectl needs. It's oaidl, which is included indirectly
through oleauto. oaidl is where interfaces like IDispatch
are defined. Also, some macros in olectl make some
SCODEs, so if you actually used those macros in olectl,
you would also need winerror.h (which defines MAKE_SCODE).
Generalized fix:
olectl includes winerror, oaidl and olectlid
olectlid includes basetyps
oaidl includes basetyps
oleauto includes winerror and basetyps
The includes would be within the #ifdefs, of course.
This analysis is based entirely on looking at the Mingw
headers and trying to let the preprocessor resolve the
dependencies so a human doesn't have to. Thus, from a
legal standpoint, it is completely safe to incorporate
into the code (no Microsoft encumbrances). However, from
a technical standpoint, in my quick tests I only tried
including the headers, not actually using what's defined
in the headers. Caveat.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=30442
Apparently olectl.h is not meant to be included alone (like
many other Win32 API headers). A quick search shows that
olectl.h is included by ocidl.h, but after ole2.h. The
mostly likely thing to work on all Windows compilers is to
just include windows.h.
However, this might still be a minor bug because MSVC
olectl.h includes ocidl.h, which is the reverse of Mingw. I
haven't used OLE so I can't say anything more definitive.
Logged In: YES
user_id=533196
windows.h does not include the olectl header; nor does it
include ole2 or oaidl -- windows.h was already included
before olectl.h in my program.
I've confirmed that the error does not occur if I include
ocidl instead of olectl, or include ole2 before I include
olectl.
I grokked the Mingw ole2.h to see what it was doing that
olectl needs. It's oaidl, which is included indirectly
through oleauto. oaidl is where interfaces like IDispatch
are defined. Also, some macros in olectl make some
SCODEs, so if you actually used those macros in olectl,
you would also need winerror.h (which defines MAKE_SCODE).
Generalized fix:
olectl includes winerror, oaidl and olectlid
olectlid includes basetyps
oaidl includes basetyps
oleauto includes winerror and basetyps
The includes would be within the #ifdefs, of course.
This analysis is based entirely on looking at the Mingw
headers and trying to let the preprocessor resolve the
dependencies so a human doesn't have to. Thus, from a
legal standpoint, it is completely safe to incorporate
into the code (no Microsoft encumbrances). However, from
a technical standpoint, in my quick tests I only tried
including the headers, not actually using what's defined
in the headers. Caveat.