I am having a problem compiling the code for my ATtiny85 circuit.

I am using the timer/counter0 in normal mode so that when it overflows it triggers the TIMER0_OVF_vect ISR. When I have that ISR in my code, it wont compile and gives this error:

wiring.c.o (symbol from plugin): In function `__vector_5':
(.text+0x0): multiple definition of `__vector_5'
sketch\Glove_heater_v1.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board ATtiny25/45/85.

Maybe I just need to use a different name for the ISR?

My Code:

//Red LED on PB0
//Blue LED on PB1
//Pushbutton PB2
//Battery voltage divider PB3
//Mosfet control PB4

#include <avr/io.h>
#include <stdint.h>
#include <avr/interrupt.h>

volatile uint8_t checkVoltage = 0;

void setup() {

   DDRB = 0b0010011; //set PB0,PB1,PB4 as output, PB2,PB3 as input
   PORTB = 0b00000011; //set PB0,PB1 HIGH so LEDs are off, other pins LOW

   //Setup TC0 for overflow interrupt trigger
   TCCR0B |= 0b00000101; //clk/1024 prescaler
   TIMSK |= 0b00000010;  //set TOIE0 enable overflow interrupt

void loop() { //do nothing in this test code


ISR(TIMER0_OVF_vect){ //Timer/counter0 interrupt check voltage
   checkVoltage = 1;

Any ideas are appreciated!

  • 2
    Arduino uses it for counting millis
    – KIIV
    Nov 16 '19 at 8:36

The error message was:

wiring.c.o [...]: multiple definition of `__vector_5'
Glove_heater_v1.ino.cpp.o [...]: first defined here

__vector_5 is TIMER0_OVF_vect. So you have one definition of this ISR in your sketch, and another one in wiring.c. This wiring.c is part of the Arduino core. As KIIV puts it in a comment, it uses TIMER0_OVF_vect for timekeeping (millis(), micros() and delay()).

You have two options for solving this:

  • you can use the other timer (Timer 1) in your sketch, and leave Timer 0 for the Arduino core
  • since you are not using the Arduino core anyway, you can get rid of it by simply defining main() in your sketch instead of setup() and loop().
  • 1
    Ah I see, thank you very much for the explanation. The final code uses both timers so, I will avoid using the Arduino core in this case. Nov 16 '19 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.