title: Atmel / Arduino: ISR(TIMER0_OVF_vect) won't compile ("first defined" in __vector_16)
body: <p>I'm currently working on a PWM modulator to "simulate" a car engine ignition commutation. Then, I will use it to drive another microcontroller which handles the conversion from a raw signal (engine's commutator) to a clean output voltage, going through the RPM-counter's galvanometer.</p>
  
  <p>This project is also a pretext for me to learn how to have a better control upon my microcontroller.</p>
  
  <p>Well, I wrote a small program, using timer0 (8 bits), and I need to trigger two interrupt service routines (ISRs):</p>
  
  <ul>
  <li>TIMER0_OVF_vect: overflow interruption</li>
  <li>TIMER0_COMPA_vect: fires on compare</li>
  </ul>
  
  <p>I have the following functions:</p>
  
  <pre><code>void configureTimer0(parameters)
  {
      cli();
  
      // Some maths
      TCCR0A = (1&lt;&lt;WGM01) | (1&lt;&lt;WGM00); // I tried to use the "Fast PWM" waveform generation mode
      TCCR0B &amp;= 0b00110000; // 5th and 4th bits are reserved. Every other bits is set to 0.
      TCNT0 = 0; // Initialize counter value to 0
  
      TCCR0B |= select_prescaler(prescaler); // Custom function to determine the right prescaler
      OCR0A = ext_OnTicks; // Output compare register is set to a predetermined numbers of ticks
  
      // Enabling overflows interrupt:
      TIMSK0 |= (1 &lt;&lt; TOIE0);
      sei(); // Enable interrupts
  }
  </code></pre>
  
  <p>Then, under certain conditions, I switch the OCIE0 bit in TIMSK0 on and off depending on the situation.
  However, the overflow interruption is always enabled.</p>
  
  <p>When I try to compile, I end up with these errors:</p>
  
  <pre><code>"C:\Users\UTILIS~1\AppData\Local\Temp\arduino_build_8383\sketch\PWM_modulator.ino.cpp.o" "C:\Users\UTILIS~1\AppData\Local\Temp\arduino_build_8383/..\arduino_cache_395570\core\core_arduino_avr_uno_a94ab6aaf61dfb93b4a8079c694a14c2.a" "-LC:\Users\UTILIS~1\AppData\Local\Temp\arduino_build_8383" -lm
  wiring.c.o (symbol from plugin): In function `__vector_16':
  
  (.text+0x0): multiple definition of `__vector_16'
  
  C:\Users\UTILIS~1\AppData\Local\Temp\arduino_build_8383\sketch\PWM_modulator.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
  
  collect2.exe: error: ld returned 1 exit status
  
  exit status 1
  Erreur de compilation pour la carte Arduino/Genuino Uno // Compilation error for Uno board (French)
  </code></pre>
  
  <p>I tried to compile with ISR(TIMER0_COMPB_vect) instead of ISR(TIMER0_OVF_vect), and it works, but indeed it's not the point of my program.</p>
  
  <p>I also tried ISR(TIMER2_OVF_vect) which is an 8-bit timer as well. I could synchronize Timer0 and Timer2 to achieve the desired effect, however I don't think it is quite clean to do so (and it prevents me to use the Timer2 capabilities).</p>
  
  <p>There is something wrong in my code, but cannot understand where the mistake is hiding.
  There is definitely something related to the wiring.c.o file.</p>
  
  <p>PS: I've looked for a solution quite a long time since the problem appears, but I could not find any way to ask Google correctly neither the Stack Overflow site.
  Apologies if I missed the right search string!</p>