From: ttan on
Why do I get this error when I #include <comdef.h> to use _bstr_t and WMI.
How do I fix this?

c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C2004: expected
'defined(id)'
c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C1012: unmatched
parenthesis : missing ')'

I modified only two place in the source file see below:
.......
C_DEFINES=-DWIN32 -DUNICODE -D_UNICODE -D_WIN32_DCOM -DPOLARITY
.......
TARGETLIBS=\
$(SDK_LIB_PATH)\advapi32.lib \
$(SDK_LIB_PATH)\comctl32.lib \
$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\ole32.lib \
$(SDK_LIB_PATH)\oleaut32.lib \
$(SDK_LIB_PATH)\user32.lib \
$(SDK_LIB_PATH)\uuid.lib \
$(SDK_LIB_PATH)\setupapi.lib\
$(SDK_LIB_PATH)\Wbemuuid.lib\
$(SDK_LIB_PATH)\Iphlpapi.lib
From: Ivan Brugiolo [MSFT] on
Can you show the oder of #includes ?
normally `comdef.h` loves to be included right after windows.h
and before other OLE2 headers

--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"ttan" <ttan(a)discussions.microsoft.com> wrote in message
news:7E281978-2641-44FC-9A43-A9DF8458E7F1(a)microsoft.com...
> Why do I get this error when I #include <comdef.h> to use _bstr_t and WMI.
> How do I fix this?
>
> c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C2004: expected
> 'defined(id)'
> c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C1012: unmatched
> parenthesis : missing ')'
>
> I modified only two place in the source file see below:
> ......
> C_DEFINES=-DWIN32 -DUNICODE -D_UNICODE -D_WIN32_DCOM -DPOLARITY
> ......
> TARGETLIBS=\
> $(SDK_LIB_PATH)\advapi32.lib \
> $(SDK_LIB_PATH)\comctl32.lib \
> $(SDK_LIB_PATH)\kernel32.lib \
> $(SDK_LIB_PATH)\ole32.lib \
> $(SDK_LIB_PATH)\oleaut32.lib \
> $(SDK_LIB_PATH)\user32.lib \
> $(SDK_LIB_PATH)\uuid.lib \
> $(SDK_LIB_PATH)\setupapi.lib\
> $(SDK_LIB_PATH)\Wbemuuid.lib\
> $(SDK_LIB_PATH)\Iphlpapi.lib


From: ttan on
pch.h file

#pragma warning (disable: 4786)

#include <windows.h>
#include <netcfgx.h>
#include <netcfgn.h>
#include <comdef.h>

#include <setupapi.h>
#include <devguid.h>
#include <tchar.h>
#include <stdio.h>

"Ivan Brugiolo [MSFT]" wrote:

> Can you show the oder of #includes ?
> normally `comdef.h` loves to be included right after windows.h
> and before other OLE2 headers
>
> --
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of any included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>
>
> "ttan" <ttan(a)discussions.microsoft.com> wrote in message
> news:7E281978-2641-44FC-9A43-A9DF8458E7F1(a)microsoft.com...
> > Why do I get this error when I #include <comdef.h> to use _bstr_t and WMI.
> > How do I fix this?
> >
> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C2004: expected
> > 'defined(id)'
> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C1012: unmatched
> > parenthesis : missing ')'
> >
> > I modified only two place in the source file see below:
> > ......
> > C_DEFINES=-DWIN32 -DUNICODE -D_UNICODE -D_WIN32_DCOM -DPOLARITY
> > ......
> > TARGETLIBS=\
> > $(SDK_LIB_PATH)\advapi32.lib \
> > $(SDK_LIB_PATH)\comctl32.lib \
> > $(SDK_LIB_PATH)\kernel32.lib \
> > $(SDK_LIB_PATH)\ole32.lib \
> > $(SDK_LIB_PATH)\oleaut32.lib \
> > $(SDK_LIB_PATH)\user32.lib \
> > $(SDK_LIB_PATH)\uuid.lib \
> > $(SDK_LIB_PATH)\setupapi.lib\
> > $(SDK_LIB_PATH)\Wbemuuid.lib\
> > $(SDK_LIB_PATH)\Iphlpapi.lib
>
>
>
From: Ivan Brugiolo [MSFT] on
I cannot repro on my side.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"ttan" <ttan(a)discussions.microsoft.com> wrote in message
news:197DA36A-4624-42BC-93F5-0FDBF5A8DF2F(a)microsoft.com...
> pch.h file
>
> #pragma warning (disable: 4786)
>
> #include <windows.h>
> #include <netcfgx.h>
> #include <netcfgn.h>
> #include <comdef.h>
>
> #include <setupapi.h>
> #include <devguid.h>
> #include <tchar.h>
> #include <stdio.h>
>
> "Ivan Brugiolo [MSFT]" wrote:
>
>> Can you show the oder of #includes ?
>> normally `comdef.h` loves to be included right after windows.h
>> and before other OLE2 headers
>>
>> --
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> Use of any included script samples are subject to the terms specified at
>> http://www.microsoft.com/info/cpyright.htm
>>
>>
>> "ttan" <ttan(a)discussions.microsoft.com> wrote in message
>> news:7E281978-2641-44FC-9A43-A9DF8458E7F1(a)microsoft.com...
>> > Why do I get this error when I #include <comdef.h> to use _bstr_t and
>> > WMI.
>> > How do I fix this?
>> >
>> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C2004: expected
>> > 'defined(id)'
>> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C1012: unmatched
>> > parenthesis : missing ')'
>> >
>> > I modified only two place in the source file see below:
>> > ......
>> > C_DEFINES=-DWIN32 -DUNICODE -D_UNICODE -D_WIN32_DCOM -DPOLARITY
>> > ......
>> > TARGETLIBS=\
>> > $(SDK_LIB_PATH)\advapi32.lib \
>> > $(SDK_LIB_PATH)\comctl32.lib \
>> > $(SDK_LIB_PATH)\kernel32.lib \
>> > $(SDK_LIB_PATH)\ole32.lib \
>> > $(SDK_LIB_PATH)\oleaut32.lib \
>> > $(SDK_LIB_PATH)\user32.lib \
>> > $(SDK_LIB_PATH)\uuid.lib \
>> > $(SDK_LIB_PATH)\setupapi.lib\
>> > $(SDK_LIB_PATH)\Wbemuuid.lib\
>> > $(SDK_LIB_PATH)\Iphlpapi.lib
>>
>>
>>


From: ttan on
I moved the comdef.h right after the windows.h and still get the error.
I build the project under windows 2000 checked build enviroment.

"Ivan Brugiolo [MSFT]" wrote:

> I cannot repro on my side.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of any included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>
>
> "ttan" <ttan(a)discussions.microsoft.com> wrote in message
> news:197DA36A-4624-42BC-93F5-0FDBF5A8DF2F(a)microsoft.com...
> > pch.h file
> >
> > #pragma warning (disable: 4786)
> >
> > #include <windows.h>
> > #include <netcfgx.h>
> > #include <netcfgn.h>
> > #include <comdef.h>
> >
> > #include <setupapi.h>
> > #include <devguid.h>
> > #include <tchar.h>
> > #include <stdio.h>
> >
> > "Ivan Brugiolo [MSFT]" wrote:
> >
> >> Can you show the oder of #includes ?
> >> normally `comdef.h` loves to be included right after windows.h
> >> and before other OLE2 headers
> >>
> >> --
> >> --
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >> Use of any included script samples are subject to the terms specified at
> >> http://www.microsoft.com/info/cpyright.htm
> >>
> >>
> >> "ttan" <ttan(a)discussions.microsoft.com> wrote in message
> >> news:7E281978-2641-44FC-9A43-A9DF8458E7F1(a)microsoft.com...
> >> > Why do I get this error when I #include <comdef.h> to use _bstr_t and
> >> > WMI.
> >> > How do I fix this?
> >> >
> >> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C2004: expected
> >> > 'defined(id)'
> >> > c:\winddk\3790.1830\inc\w2k\comdef.h(266) : error C1012: unmatched
> >> > parenthesis : missing ')'
> >> >
> >> > I modified only two place in the source file see below:
> >> > ......
> >> > C_DEFINES=-DWIN32 -DUNICODE -D_UNICODE -D_WIN32_DCOM -DPOLARITY
> >> > ......
> >> > TARGETLIBS=\
> >> > $(SDK_LIB_PATH)\advapi32.lib \
> >> > $(SDK_LIB_PATH)\comctl32.lib \
> >> > $(SDK_LIB_PATH)\kernel32.lib \
> >> > $(SDK_LIB_PATH)\ole32.lib \
> >> > $(SDK_LIB_PATH)\oleaut32.lib \
> >> > $(SDK_LIB_PATH)\user32.lib \
> >> > $(SDK_LIB_PATH)\uuid.lib \
> >> > $(SDK_LIB_PATH)\setupapi.lib\
> >> > $(SDK_LIB_PATH)\Wbemuuid.lib\
> >> > $(SDK_LIB_PATH)\Iphlpapi.lib
> >>
> >>
> >>
>
>
>