Error while compiling sketch

am getting an error while compiling

"Arduino: 1.5.6-r2 (Windows 8), Board: "Arduino NG or older, ATmega8"

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.cpp:32:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\/HardwareSerial_private.h: In member function 'void HardwareSerial::_rx_complete_irq()':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\/HardwareSerial_private.h:98: error: 'UPE' was not declared in this scope

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.""

You are most likely trying to use the variable or function "UPE" before it has been declared.

I'm also facing the same problem. My OS is win7 64 bit and I'm using atmega8 chip.

saugata_roy:
I'm using atmega8 chip.

Does it compile OK if you select the Uno as the Board?

If so it seems there is a difference with an atmega8. Does it have a hardware serial port?

...R

I have the same problem, the old (1.05) IDE works but unable to use may USBasp programmer (it wants to use it trough a COM port :astonished: instead of USB directly).
The Boot Code updated anyway without any issues using avrdude by hand (Kubuntu 14.04 AMD64)

The IC is ATMega8A - and reading the manual it has "Programmable Serial USART" - if You mean it.

I've found this remark in HardwareSerial_private.h at line 36:

// On ATmega8, the uart and its bits are not numbered, so there is no TXC0 etc.

And it compiled nicely setting on another cpus.

I think there´s a new bug in 1.5.6r2.
I tried to compile the blink example for atmega8 and it gave same message as yours.
I compiled in the 1.5.5r2 and it´s ok.
In 1.5.6r2 i compiled the same code for arduino uno and it´s ok.
I tried in the windows 7 and windows 8.1 and the result was the same.
Let me know if with you this occurs the same.

I am having the same problem only for the atmega16.

I have accommodated the PE/UPE bug as far as I can tell by using

however I a still getting errors when compiling for atmega16

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.cpp:32:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial_private.h: In member function 'void HardwareSerial::_rx_complete_irq()':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial_private.h:107: error: 'rx_buffer_index_t' was not declared in this scope
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial_private.h:107: error: expected `;' before 'i'
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial_private.h:113: error: 'i' was not declared in this scope

wait, scratch that last issue, I was having a file location issue.

adding these lines to HardwareSerial_private seems to fix it