On Sat, Jan 15, 2005 at 03:40:04PM +0530, Nakul Aggarwal wrote:
> Hi,
>   Whenever i try to compile net-snmp library using g++ ...it gives
> folowoing errors :
>  
>  ========================ERROR=============
>  -- conflicting types for `struct oid'
>  /usr/include/net-snmp/types.h:47: previous declaration as `typedef
>  u_long oid'
>  oid_defn.h:14: field `Oid' has incomplete type
>  initializers_oid.cpp: In function `void initialize (oid *)':
>  initializers_oid.cpp:11: `struct oid' has no member named `Oid'
>  initializers_oid.cpp:11: `struct oid' has no member named `Oid'
>  initializers_oid.cpp:12: `struct oid' has no member named `Oid'
>  ==============END========================

Here the compiler complains since

struct oid { /* whatever */ };

is indeed incompatible with

typedef u_long oid; /* From include/net-snmp/types.h */

and then it goes on to say that the typedef lacks the member named Oid.

>  Isnt Net-Snmp library compatible with C++ ?

I have never had any major problems :-)

>  =================code for initializers_oid.cpp==========
>  #include "oid_defn.h"
>  
>  void initialize (struct oid *given)
>  {
>     struct oid *op = given;
>     init_snmp("asynchapp");
>     //struct host ho = Router_struct.Ip;
>     /* parse the oids */
>     while (op->Name)
>     {
>        op->OidLen = sizeof(op->Oid)/sizeof(op->Oid[0]);
>        if (!read_objid(op->Name, op->Oid, &op->OidLen))
>        {
>           snmp_perror("read_objid");
>           exit(1);
>        }
>        op++;
>     }
>  }
>  ================================
>  while Oid_defn.h contains the standard struct OID defn of net-snmp
> library. i.e.
>  struct oid {
>    const char *Name;
>    oid Oid[MAX_OID_LEN];
>    int OidLen;
>  };

This is the part I utterly fail to comprehend - what netsnmp file provides 
this definition of struct oid? I fail to find it and would like to get a
reference. (No, I have no file named oid_defn.h)

Oh yes, the above struct would be erraneous even in isolation since it tries
to recursively define the member Oid as an array of the incomplete type
struct oid.

/MF


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to