AdaEncoder (ooPinChangeInt) Library won't compile on Mega2560

Trying to compile the AdaEncoder library from the MyEncoder example Google Code Archive - Long-term storage for Google Code Project Hosting. I get this error:

In file included from MyEncoder.pde:3:
/Users/turgo/Documents/Arduino/libraries/ooPinChangeInt/ooPinChangeInt.h:230: error: no matching function for call to ‘PCintPort::PCintPort(int, int, volatile unsigned char&)’
/Users/turgo/Documents/Arduino/libraries/ooPinChangeInt/ooPinChangeInt.h:164: note: candidates are: PCintPort::PCintPort(int, volatile uint8_t&)
/Users/turgo/Documents/Arduino/libraries/ooPinChangeInt/ooPinChangeInt.h:162: note:                 PCintPort::PCintPort(const PCintPort&)
/Users/turgo/Documents/Arduino/libraries/ooPinChangeInt/ooPinChangeInt.h:234: error: no matching function for call to 'PCintPort::PCintPort(int, int, volatile unsigned char&)'
/Users/turgo/Documents/Arduino/libraries/ooPinChangeInt/ooPinChangeInt.h:164: note: candidates are: PCintPort::PCintPort(int, volatile uint8_t&)
/Users/turgo/Documents/Arduino/libraries/ooPinChangeInt/ooPinChangeInt.h:162: note:                 PCintPort::PCintPort(const PCintPort&)

Looking at those lines, the “PCintPort(10,1,PCMSK1)” call has an extra argument. How should it read?

223  #ifndef NO_PORTD_PINCHANGES
224  PCintPort portD=PCintPort(2,PCMSK2); // port PD==4
225  #endif
226
227  #ifdef __USE_PORT_JK
228
229  #ifndef NO_PORTJ_PINCHANGES
230  PCintPort portJ=PCintPort(10,1,PCMSK1); // port PJ==10 
231  #endif
232
233  #ifndef NO_PORTK_PINCHANGES
234  PCintPort portK=PCintPort(11,2,PCMSK2); // port PK==11
235  #endif
236
237  #endif

Can anyone suggest a fix?

Since it appears to be complaining about something which it sees in that h file, which it doesn't like, my advice would be to see which other h files the offending h file #includes, and check those. You might have an out-of-date version of one of them.

Thanks michinyon. Your idea about versions got me thinking that it might be a change between versions. Sure enough, the offending code section had been copied from the latest standard version of the PinChangeInt library, which added an new 'index' parameter. I deleted that parameter, and it now compiles.

#ifndef NO_PORTJ_PINCHANGES
// PCintPort portJ=PCintPort(10,1,PCMSK1); // port PJ==10     original version, error, copied from PinChangeInt 2.19 (beta)
PCintPort portJ=PCintPort(10,PCMSK1); // port PJ==10          eliminated middle 'index' parameter
#endif

#ifndef NO_PORTK_PINCHANGES
//PCintPort portK=PCintPort(11,2,PCMSK2); // port PK==11    original version, error, copied from PinChangeInt 2.19 (beta)
PCintPort portK=PCintPort(11,PCMSK2); // port PK==11        eliminated middle 'index' parameter
#endif

I've attached the corrected ooPinChangeInt library below:

ooPinChangeInt.h (15.9 KB)