Ethereal-dev: Re: [ethereal-dev] Problem compiling with C++ compiler

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Thu, 23 Mar 2000 10:45:50 -0600
On Thu, Mar 23, 2000 at 09:21:06AM -0600, andreas.sikkema@xxxxxxxxxxx wrote:
> 
> 
> Hi
> 
> For a new plugin I have to use a C++ compiler. The compiler complains about 
> a couple of
> things that are easily corrected, but for some problems I don't know why 
> they are used there:
> 
> > ../..\proto.h(45) : error C2371: 'GNode' : redefinition; different basic 
> types
> >       C:\tools\gtk-dev\src\glib\glib.h(694) : see declaration of 'GNode'
> The line (and the one after it) in proto.h do this:
>   typedef struct GNode proto_tree;
>   typedef struct GNode proto_item;
> According to the compiler they redefine GNode, is that's supposed to 
> happen? I'm not that
> good at C, so I might be wrong here.

It's the opposite. The typedefs create types called 'proto_tree' and 'proto_item'
that are synonyms for 'struct GNode'.

> 
> ../..\packet.h(200) : error C2371: 'value_string' : redefinition; different 
> basic types
>         ../..\proto.h(47) : see declaration of 'value_string'
> Proto.h: struct value_string;
> Packet.h declares the struct, is this a forward declaration? Can 
> value_string be moved from
> packet.h to proto.h?

Yes, this is a forward declaration. I guess it could, since packet.h
includes proto.h. But the better question is to find out why the C++
compiler doesn't like valid C. I'm not a C++ user, so I can't answer that.

--gilbert