On Wed, Jul 30, 2008 at 04:39:44PM +0300, Christophe Melki wrote:

> Then I tried to program a C++ API to get it to poll several server 
> using snmp agents and gather information in a database. On the 
> net-snmp 
> tutorial website, there is a example code about asynchronous polling 
> which is perfect for my demand, but is coded in C.
> I tried compiling it with C++, but I get one error that makes my 
> application fail, and this error does not show if I compile in C.

It's a namespace thing.

> struct oid {
> const char *Name;
> oid Oid[MAX_OID_LEN];
> int OidLen;
> }

[excerpted error message]

> g++ -I/usr/local/include -I/usr/include/mysql -g   -c Testincpp.cpp 
> -o Testincpp.oTestincpp.cpp:41: error: conflicting declaration 'struct 
> oid'/usr/include/net-snmp/types.h:47: error: 'oid' has a previous 
> declaration as `typedef u_long oid'

The struct named 'oid' is colliding with the typedef for 'oid'.  Change 
the struct name and you should be good to go.
-- 
Roy M. Silvernail is [EMAIL PROTECTED], and you're not
   "A desperate disease requires a dangerous remedy."
                   - Guy Fawkes
            http://www.rant-central.com


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to