Error compiling while using Servo

For my project on an arduino mega, I need to use the Servo Library for 2 different servo outputs. I checked on several sources, and the Servo library is supposed to use only timer 5 for the first 12 servos. However, when I try to use another of the 16 bits timers on the arduino with an interrupt, I get the following error when compiling

Servo\Servo.cpp.o: In function `__vector_17':
C:\Users\Max\Downloads\arduino-1.0\libraries\Servo/Servo.cpp:103: multiple definition of `__vector_17'
PI4.cpp.o:C:\Users\Max\AppData\Local\Temp\build9022493288731351801.tmp/PI4.cpp:51: first defined here

my setup code for the timer:


I think the refered line in my code is the interrupt function definition:


in this case it's timer 3, but I tried the same for timer 1 and 4. Timer 2 is usable, but I'd prefer a 16 bits timer.

I don't know if I understand the problem correctly, but if that's the problem ,I'd like to know if I can simply alter servo.h or servo.cpp to limit its reach to timer 5, since it will be more than enough for my use.


Yes you can alter it - but then it'll be your responsibility to track new versions of the library and remember not to just overwrite it with a future release.

Suggest renaming the class to make it obvious its not the standard version. Note which timers are used is all setup in Servo.h

I think its trying not to use timers it doesn't need, but has to compile interrupt routines for all the ones it might use, hence the clash.