Multiple Declarations in Windows.h

Hi Everyone, I have an issue getting certain headers from the Win32 API to work together. Even when I declare the actual path to the Win7 DDK that I have downloaded for the header I get 160+ errors when I go to compile the EXE. The first thing that I notice is that a lot of them are from the header files calling eachother over and over.

My first attempt to resolve this was to simply declare the headers in different .cpp files. But annoyingly enough the headers that get in eachothers way seem to actually depend on one and other to function >:O!

My second thought, which I have not gone through with yet, was to make local copies of the headers and comment out or #ifndef the conflicting lines. But this seems like a boat load of work and I don't think I'll do that unless one of you guys says that is what is necessary.

I'll be googling in the mean time.

EXAMPLE CONFLICT: wbemcli.h and windows.h with regards to rpc.h being redeclared in each file. There are lots more if this doesn't give any results.
Last edited on
Can you provide an example of the headers you're including?

I've just had a look at some of my old WMI stuff and I only use wbemidl.h, which pulls in wbemcli.h, but must also pull in windows.h as the app has all that COM crap.
Yeah, that "COM Crap" is what I'm trying to work with\learn, and I'm starting to see the source of all of the animosity toward this moderatley attractive yet barley useable "feature". I've worked my self into a corner by misunderstanding something I think.

1
2
3
4
5
6
7
8
9
10
//#define _WIN32_DCOM                 /*This are here to document things I've tried*/
//#define WIN32_LEAN_AND_MEAN /*This are here to document things I've tried*/

#include <cstdlib>
#include <iostream>
using namespace std;
#include <ObjBase.h> /*I've tried with and without this here*/
#include <windows.h>
#include <wbemidl.h>
# pragma comment(lib, "wbemuuid.lib") /*Side note, this is a comment right?*/ 


And here are two of the sites I'm working with:
http://msdn.microsoft.com/en-us/library/aa390423(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa389749(VS.85).aspx

EDIT: Also I'm using ole32.lib and wbemuuid.lib as per the relavent functions documentation pages.

REEDIT: Fixing Grammer & Tone
Last edited on
Topic archived. No new replies allowed.