Arduino-SNMP icon indicating copy to clipboard operation
Arduino-SNMP copied to clipboard

encode() overload is ambiguous

Open wlp5s0 opened this issue 2 years ago • 0 comments

hi file ArduinoSNMP.h, inside function: void prepare_trapv2(SNMP_VALUE *t_v)

//This line below causes error, millis() type doesn't have a definite type. 
//This produces different candidates for one overloaded function call.
//t_v->encode(SNMP_SYNTAX_TIME_TICKS, millis()/10);
t_v->encode(SNMP_SYNTAX_TIME_TICKS, (const uint16_t)millis()/10);

It was giving me error while compiling in Arduino IDE 2.0 for RP2040.

What helped was adding (). This way the whole division result is uint16_t, not millis itself.

t_v->encode(SNMP_SYNTAX_TIME_TICKS, (const uint16_t) (millis()/10));

wlp5s0 avatar Sep 29 '23 20:09 wlp5s0