error: ‘TIMSK2’ was not declared in this scope

Hi All,

I'm working in the eclipse IDE. I have an old project in which I manipulate the timers directly on a Fio board. It used to work fine, but now that I am using the newest version of the Arduino library, I get the following errors:

error: ‘TIMSK2’ was not declared in this scope
error: ‘TCCR2A’ was not declared in this scope
error: ‘TCCR2B’ was not declared in this scope
error: ‘WGM22’ was not declared in this scope
error: ‘OCIE2A’ was not declared in this scope

Where are these things defined? I noticed that I can use them directly in the Arduino IDE but for some reason my eclipse project can't find them anymore. Thanks!

#include <avr/io.h>

... which is included by Arduino.h - you are including Arduino.h at the top of your program, aren't you?

yes, both Arduino.h and avr/io.h ar eincluded at the top of my program

io.h includes the right iomxxx.h file for the chip on your board - supposedly.

#elif defined (__AVR_ATmega328P__)
#  include <avr/iom328p.h>

Maybe that symbol's not getting defined right? Try manually including avr/iom328p.h

hmm, now I get:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom328p.h:45:4: error: #error "Attempt to include more than one <avr/ioXXX.h> file."

Do any of the header files in the project use Wiring.h is so it need Arduino.h

Mark

Ok, so some iomxxx.h file is being included - no easy way of telling which one though.

If it's in there, then it should have the TIMSK2:

#define TIMSK2 _SFR_MEM8(0x70)

Are you sure you're compiling with the right processor selected?

OK Thanks. This led me to find the problem. You were right.
I commented io.h so that only the correct chip was defined, then it worked. Turns out the correct chip wasn't being defined properly in eclipse. On to solving new errors...