Menu

#138 #include <olectl.h> fails

closed-invalid
None
2002-08-05
2002-05-10
No

This won't compile:

#include <olectl.h>

int main(int,char**) {
return 0;
}

Discussion

  • Luke Dunstan

    Luke Dunstan - 2002-05-10

    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.

     
  • Bruce Dodson

    Bruce Dodson - 2002-05-13

    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.

     
  • Earnie Boyd

    Earnie Boyd - 2002-08-05
    • assigned_to: nobody --> earnie
    • status: open --> closed-invalid