🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.mac.programmer.codewarrior
4 messages
4 total messages Started by David Alter Fri, 20 Feb 2004 06:48
c++ and including ocidl.h build problem
#1477
Author: David Alter
Date: Fri, 20 Feb 2004 06:48
48 lines
2367 bytes
I'm having a problem with compiling c++ and including <ocidl.h> for
windows. I'm using Codewarrior 8.0. When I compiled this project as C
it worked fine. Once I enable C++ I get the following error, and 70 or
so like it.

Error   : illegal struct/union/enum/class definition
(included from:
 exdisp.h:238
 shlguid.h:220
 shlobj.h:102
 PC_ChooseDialog.cpp:1)
ocidl.h line 566   IConnectionPoint : public IUnknown

Error   : illegal struct/union/enum/class definition
(included from:
 exdisp.h:238
 shlguid.h:220
 shlobj.h:102
 PC_ChooseDialog.cpp:1)
ocidl.h line 751   IEnumConnectionPoints : public IUnknown

The problem appears to be with the "public IUnknown". If I edit
ocidl.h and comment out the ": public IUnknown" It will get past that
error. I have run it through the preprocessor and this is the output
it generates.

struct
IEnumConnections : public IUnknown
{
public:
virtual HRESULT __stdcall Next(
ULONG cConnections,
LPCONNECTDATA rgcd,
ULONG *pcFetched) = 0;
virtual HRESULT __stdcall Skip(
ULONG cConnections) = 0;
virtual HRESULT __stdcall Reset( void) = 0;
virtual HRESULT __stdcall Clone(
IEnumConnections * *ppEnum) = 0;
};

I would have thought it would have been class and not struct but I
don't think that is the issue. What ever the case I should no be
editing the Win32 .h files. Does anyone know what is going on here and
how I can get around it.

thanks
-dave
Re: c++ and including ocidl.h build problem
#1478
Author: MW Ron
Date: Fri, 20 Feb 2004 14:51
71 lines
3328 bytes
In article <e4af91cf.0402192248.476671ee@posting.google.com>,
 David@alterconsulting.net (David Alter) wrote:

>I'm having a problem with compiling c++ and including <ocidl.h> for
>windows. I'm using Codewarrior 8.0. When I compiled this project as C
>it worked fine. Once I enable C++ I get the following error, and 70 or
>so like it.

Windows uses some stuff that is not legal C++  they treat struct and 
class as different types with different rules.   While C++ says they are 
the same, (just one is public by default the other private by default)

Do you have treat all warnings as errors on?  If so turn off the 
inconsidtnet use of class and struct keywords

If that doesn't work can you preprocess a file that has this error and 
send it to me (strip out as much as possible that still leaves the 
error) and I'll check it out.

Thanks for any cooperation.

Ron

>Error   : illegal struct/union/enum/class definition
>(included from:
> exdisp.h:238
> shlguid.h:220
> shlobj.h:102
> PC_ChooseDialog.cpp:1)
>ocidl.h line 566   IConnectionPoint : public IUnknown
>
>Error   : illegal struct/union/enum/class definition
>(included from:
> exdisp.h:238
> shlguid.h:220
> shlobj.h:102
> PC_ChooseDialog.cpp:1)
>ocidl.h line 751   IEnumConnectionPoints : public IUnknown
>
>The problem appears to be with the "public IUnknown". If I edit
>ocidl.h and comment out the ": public IUnknown" It will get past that
>error. I have run it through the preprocessor and this is the output
>it generates.
>
>struct
>IEnumConnections : public IUnknown
>{
>public:
>virtual HRESULT __stdcall Next(
>ULONG cConnections,
>LPCONNECTDATA rgcd,
>ULONG *pcFetched) = 0;
>virtual HRESULT __stdcall Skip(
>ULONG cConnections) = 0;
>virtual HRESULT __stdcall Reset( void) = 0;
>virtual HRESULT __stdcall Clone(
>IEnumConnections * *ppEnum) = 0;
>};
>
>I would have thought it would have been class and not struct but I
>don't think that is the issue. What ever the case I should no be
>editing the Win32 .h files. Does anyone know what is going on here and
>how I can get around it.
>
>thanks
>-dave

-- 

Metrowerks, maker of CodeWarrior   -  "Software Starts Here"  
Ron Liechty - MWRon@metrowerks.com - <http://www.metrowerks.com>
Re: c++ and including ocidl.h build problem
#1479
Author: David Alter
Date: Fri, 20 Feb 2004 22:01
28 lines
2067 bytes
Hi Ron,

> >I'm having a problem with compiling c++ and including <ocidl.h> for
> >windows. I'm using Codewarrior 8.0. When I compiled this project as C
> >it worked fine. Once I enable C++ I get the following error, and 70 or
> >so like it.
> 
> Windows uses some stuff that is not legal C++  they treat struct and 
> class as different types with different rules.   While C++ says they are 
> the same, (just one is public by default the other private by default)
> 
> Do you have treat all warnings as errors on?  If so turn off the 
> inconsidtnet use of class and struct keywords
> 

No I do not. And I already have "Inconsistent Use of 'class' and
'struct' Keywords" disabled. Do you have nay other ideas?

> If that doesn't work can you preprocess a file that has this error and 
> send it to me (strip out as much as possible that still leaves the 
> error) and I'll check it out.

I have packaged up a project and sent it to you. Please let me know
what you find out.

Thanks for the help
-dave
>
Re: c++ and including ocidl.h build problem
#1480
Author: MW Ron
Date: Fri, 20 Feb 2004 23:49
45 lines
2767 bytes
In article <e4af91cf.0402201401.a4b1b52@posting.google.com>,
 David@alterconsulting.net (David Alter) wrote:

>Hi Ron,
>
>> >I'm having a problem with compiling c++ and including <ocidl.h> for
>> >windows. I'm using Codewarrior 8.0. When I compiled this project as C
>> >it worked fine. Once I enable C++ I get the following error, and 70 or
>> >so like it.

The problem was you were using the precompiled header and not a prefix 
file.  There are two types of prpecompiled headers  one has  just .mch  
the other is ++.mch  and is precompiled as C++

Changing this fixed your target to build just fine.

Ron


>> Windows uses some stuff that is not legal C++  they treat struct and 
>> class as different types with different rules.   While C++ says they are 
>> the same, (just one is public by default the other private by default)
>> 
>> Do you have treat all warnings as errors on?  If so turn off the 
>> inconsidtnet use of class and struct keywords
>> 
>
>No I do not. And I already have "Inconsistent Use of 'class' and
>'struct' Keywords" disabled. Do you have nay other ideas?
>
>> If that doesn't work can you preprocess a file that has this error and 
>> send it to me (strip out as much as possible that still leaves the 
>> error) and I'll check it out.
>
>I have packaged up a project and sent it to you. Please let me know
>what you find out.
>
>Thanks for the help
>-dave
>>

-- 

Metrowerks, maker of CodeWarrior   -  "Software Starts Here"  
Ron Liechty - MWRon@metrowerks.com - <http://www.metrowerks.com>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads