Duemilanove acting weird with GPS

Hello guys! hope you can help me out.. it's pretty urgent becuz its a project due soon and i can't figure it out. ):

int incomingData;
int RX = 0;

void setup()
{
pinMode(RX, INPUT);
Serial.begin(38400);
Serial.print("Now tracking GPS...");
}

void loop()
{
if(Serial.available() > 0)
{
incomingData = Serial.read();
Serial.print(incomingData);
}
}

This block of code what i wanna upload to my arduino duemilanove w/ ATmega328.

my problem is this, whenever i try to upload, avrdude: stk500_getsync(): not in sync: resp=0x00 appears.
I have looked up the common problems but none of those seems to be the cause!

while i learnt from other users that i can connect the TX pin of board to the OUTPUT pin of the gps to directly view the data being output by the GPS on the serial monitor, i can only upload without getting the error statement above when i connect this way. but what i really want is to read and process the data received, which i suppose i have to use the RX pin instead.

So my question is, how do i get the board to respond to the upload when the RX pin of the board is connected to the OUT pin of the GPS?

One thing you can do is upload this sketch:

void setup()
  {
  pinMode(0, INPUT);
  pinMode(1, INPUT);
  }
void loop() {}

That will disconnect the ATmega chip from the serial port pins. You can then connect the GPS to the serial port pins (GPS TX to Arduino TX) and view the GPS output directly with Serial Monitor.

If you have an Arduino with a removable processor you can get the same effect by removing the processor chip.

Either wat you are using just the USB to Serial conversion part of the Arduino to connect your GPS to your PC.

So my question is, how do i get the board to respond to the upload when the RX pin of the board is connected to the OUT pin of the GPS?

Pretty simple, really. Unplug the GPS.

You really should not be using the hardware serial port to read a GPS. You can, of course, connect the GPS to any two pins and use NewSoftSerial (pre 1.0) or SoftwareSerial (1.0 and later) to talk to the GPS.