Compiling error

Hi, I use sample code and get error:

d:/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o: In function __vector_default':** **(.vectors+0xdc): relocation truncated to fit: R_AVR_13_PCREL against symbol __vector_55' defined in .text.__vector_55 section in core.a(HardwareSerial.cpp.o)

sample code is:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //pin2 Rx, pin3 Tx
void setup()
{
Serial.begin(9600);
Serial.println("Serial number will be displayed here if a card is detected by the module:\n");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.write(0x02); //Send the command to RFID, please refer to RFID manual
}
void loop() // run over and over
{
if (mySerial.available())
Serial.print(mySerial.read(),HEX); //Display the Serial Number in HEX
if (Serial.available())
mySerial.write(Serial.read());
}

can anyone help to fix this problem?

It compiles OK for me
Win 7
IDE 1.0.5
target board set to Uno

What do you have ?

now I try on UNO and it wors fine, but I have MEGA 2560 and it have error. And I use win7, IDE 1.0.5

Search this forum for R_AVR_13_PCREL and you will find that others have had the problem.

but I have MEGA 2560

With 4 hardware serial ports. Why are you using SoftwareSerial, then? Why are you trying to use it on pins that it can't be used on, on the Mega?

Just grabbing some code, mindlessly, and expecting it to work on another board is not smart.