Problem compilling with Servo.h and VirtualWire.h

hi i got this error while trying to verify/upload my sketch.

Servo\Servo.cpp.o: In function __vector_11': C:\Program Files\arduino-1.0.1\libraries\Servo/Servo.cpp:103: multiple definition of __vector_11'
VirtualWire\VirtualWire.cpp.o:C:\Program Files\arduino-1.0.1\libraries\VirtualWire/VirtualWire.cpp:416: first defined here

here is my full code

#include <VirtualWire.h>
#include <Servo.h>

  int ledPin = 13;
  Servo motorPin;
  Servo motorPin2;
  Servo motorPin3;
  Servo motorPin4;
  
  
  
  void setup()
  {
      Serial.begin(9600);	// Debugging only
      Serial.println("setup");
  
      // Initialise the IO and ISR
      vw_set_ptt_inverted(true); // Required for DR3100
      vw_setup(2000);	 // Bits per sec
      vw_set_rx_pin(2);
      vw_rx_start();       // Start the receiver PLL running
  
  pinMode(ledPin, OUTPUT);
  motorPin.attach(12);
  motorPin2.attach(11);
  motorPin3.attach(9);
  motorPin4.attach(8);
  }

  void loop()
  {
  
  
  
      uint8_t buf[VW_MAX_MESSAGE_LEN];
      uint8_t buflen = VW_MAX_MESSAGE_LEN;
  
      if (vw_get_message(buf, &buflen)) // Non-blocking
      {
        
        
  	int i= 0;
  
        // Flash a light to show received good message
  	// Message with a good checksum received, dump it.
  	Serial.print("Got: ");
          if(buf[i] == '1')
          {
            digitalWrite(ledPin, HIGH); 
            motorPin.write(180);
            motorPin2.write(180);
            motorPin3.write(180);
            motorPin4.write(180);
          }
       
         if(buf[i] == '2')
          {
            digitalWrite(ledPin, HIGH); 
            motorPin.write(180);
            motorPin2.write(0);
            motorPin3.write(180);
            motorPin4.write(0);
          }
      
      
        
        if(buf[i] == '3')
       {
            digitalWrite(ledPin, HIGH); 
            motorPin.write(0);
            motorPin2.write(180);
            motorPin3.write(0);
            motorPin4.write(180);
          }
        
        if(buf[i] == '4')
        {
            digitalWrite(ledPin, HIGH); 
            motorPin.write(0);
            motorPin2.write(0);
            motorPin3.write(0);
            motorPin4.write(0);
          }

        if(buf[i] == '5')
        {
            digitalWrite(ledPin, HIGH); 
            motorPin.write(90);
            motorPin2.write(90);
            motorPin3.write(90);
            motorPin4.write(90);
          }
          
 

        digitalWrite(ledPin, LOW);
  
          
  
     }
     

     
     
     
     
     
  }

also some little info

I'm using

-Arduino uno
-RF Link Transmitter - 434MHz
-RF Link Receiver - 4800bps (434MHz)
-using Arduino 1.01

so do you guys have any idea on how i can fix this? :~

motorPin.attach(12);
motorPin2.attach(11);

11 & 12 are the default pins for virtual wlre.
You need to use the commands like this one

vw_set_rx_pin(2);

to change them both.

VirtualWire.cpp:

// This is the interrupt service routine called when timer1 overflows
// Its job is to output the next bit from the transmitter (every 8 calls)
// and to call the PLL code if the receiver is enabled
//ISR(SIG_OUTPUT_COMPARE1A)
SIGNAL(TIMER1_COMPA_vect)   // <<---- line 416
{

Servo.cpp:

// Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
// Interrupt handlers for Arduino 
#if defined(_useTimer1)
SIGNAL (TIMER1_COMPA_vect)   // <<----- line 103
{ 
  handle_interrupts(_timer1, &TCNT1, &OCR1A); 
}

They both user Timer 1. Thus they are incompatible.

So is there a way around that?

Rewrite VirtualWire to use another timer?

Hi,
I have same problem with above servo.h and virtualwire.h not working together because of they are using same TIMER.
The solution is;

I know it but how can we rewrite virtualwire.cpp?
I changed SIGNAL(TIMER1_COMPA_vect) to SIGNAL(TIMER2_COMPA_vect) then I saved file. Afterwards virtualwire not works any more with or without servo.h library.
help ;(

There is more to it than that. For one thing Timer1 is a 16-bit timer and Timer2 is an 8-bit timer. Next you have to change other stuff to make it use that timer.

Hi Nick,
Thanks for replying,
I changed SIGNAL(TIMER1_COMPA_vect) to SIGNAL(TIMER2_COMPA_vect) just because of this link Demande d'aide pour ce code (Voiture téléguidée) - Français - Arduino Forum (pls look at the undermost message). He changed timer1 to timer2 then it works as far as I understand it (meanwhile I dont know french, I used google translation.)
As I learn timer0/2 8bit timer1/3/4/5 8bit timers. And the solution of this problem is using ServoTimer2 or SoftwareServo library. But I want to use servo.h and virtualwire.h
What can I do more ? What will be changed in virtualwire.cpp?
thanks

Note: when I write virtualwire.cpp library codes it gives an error max length (9500 characters)