[AGENT++] snmp++ noob question OFF TOPIC
don radick
dradick at mindspring.com
Wed Aug 25 01:28:42 CEST 2004
Jochen,
Thanks for the friendly, and fast advice, but I mis-typed my query
rather than pasting in the source and compiler output, and then
I found the real problem. It's a truism that you tend to find the problem
after you've shown it publicly!
Here's the class as written:
class SnmpQueryBase : public Snmp
{
private:
// class- based version of snmp++ snmp_vars
snmp_version _version; // default is v1
int _retries; // default retries is 1
int _timeout; // default is 1 second
u_short _port; // default snmp port is 161
OctetStr _community; // lab community name
int _status; // status code from snmp++
api calls
Oid _oid;
Snmp _snmp_session; // HERE'S THE PROBLEM!!! no param to Snmp ctor
Pdu _pdu; // protocol data unit
Vb _vb; // varbind struct
public:
SnmpQueryBase(int &_status);
virtual ~SnmpQueryBase();
};
Since the header file did not give any errors, I kept looking in the
.cpp file
where I had properly defined Snmp(status) in an initializer
The definition of: Snmp _snmp_session;
resulted in an error from gcc: "no matching function for call to
Snmp::Snmp()"
regards, and apologies for wasted bandwidth.
-Don
Jochen Katz wrote:
> Hi,
>
>
>> I'm trying to extend the Snmp class, and can't get a compile -
>
>
>> class SnmpQueryBase : public Snmp
>> {
>> SnmpQueryBase(int &stat);
>> }
>
>
>> SnmpQueryBase::SnmpQueryBase(int &stat) : Snmp(stat)
>
>
> try to find the fix ;-)
>
> class SnmpQueryBase : public Snmp
> {
> SnmpQueryBase(int &stat);
> };
>
>
> SnmpQueryBase::SnmpQueryBase(int &stat) : Snmp(stat) {};
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> You forgot a ";" at the end of the class definition...
>
> | error: ISO C++ forbids defining types within return type
> | error: return type specification for constructor invalid
>
>
> Regards,
> Jochen
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://agentpp.org/mailman/listinfo/agentpp
>
More information about the AGENTPP
mailing list