On Tue, Jun 4, 2013 at 4:27 AM, Mark Brand wrote:
> I have been getting my feet wet building various packages using w32api-4.0-1-
> mingw32-rc-2 and mingwrt-4.0-1-mingw32-rc-2. In many cases, the builds fail
> until I add some extra "#include <windows.h>". To illustrate, the following
> code compiles successfully using w32api-3, but fails using w32api-4.0-1 unless
> windows.h is included before objbase.h:
> #include <objbase.h>
> int main()
> return 0;
> In this particular case, objbase.h by itself includes rpc.h which includes
> windows.h, which indirectly introduces an rpc*.h header with undeclared types
> that come later in the rpc.h. I'm not sure why it works with w32api-3.
> Is this change by design? What is the correct practice for programmers? Should
> windows.h be included before any other w32api headers (except for winsock2.h,
> which must precede windows.h, to prevent accidental winsoch.h inclusion)?
I don't think for objbase.h it was intentional to require windows.h
before using objbase.h. I'll have to research what went wrong.
However, it is probably the better idea for you to include windows.h
before any other header, even WIN32_LEAN_AND_MEAN. MSDN though
doesn't state you should for objbase.h though.