Unmodified ArduinoISP will not compile

I tried to load the ArduinoISP sketch that comes with the IDE, without modifying it, and this is what I get:

In file included from ArduinoISP.cpp:66:
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/pins_arduino.h:66: error: previous declaration of 'const uint16_t port_to_mode_PGM []' with 'C++' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/Arduino.h:127: error: conflicts with new declaration with 'C' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/pins_arduino.h:67: error: previous declaration of 'const uint16_t port_to_input_PGM []' with 'C++' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/Arduino.h:128: error: conflicts with new declaration with 'C' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/pins_arduino.h:68: error: previous declaration of 'const uint16_t port_to_output_PGM []' with 'C++' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/Arduino.h:129: error: conflicts with new declaration with 'C' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/pins_arduino.h:70: error: previous declaration of 'const uint8_t digital_pin_to_port_PGM []' with 'C++' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/Arduino.h:131: error: conflicts with new declaration with 'C' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/pins_arduino.h:72: error: previous declaration of 'const uint8_t digital_pin_to_bit_mask_PGM []' with 'C++' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/Arduino.h:133: error: conflicts with new declaration with 'C' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/pins_arduino.h:73: error: previous declaration of 'const uint8_t digital_pin_to_timer_PGM []' with 'C++' linkage
C:\Program Files (x86)\Arduino\arduino-0022\hardware\arduino\cores\arduino/Arduino.h:134: error: conflicts with new declaration with 'C' linkage
ArduinoISP:56: error: new declaration 'uint8_t write_flash(int)'
ArduinoISP:25: error: ambiguates old declaration 'void write_flash(int)'
ArduinoISP.cpp: In function 'void setup()':
ArduinoISP:601: error: redefinition of 'void setup()'
ArduinoISP:67: error: 'void setup()' previously defined here
ArduinoISP.cpp: At global scope:
ArduinoISP:611: error: redefinition of 'int error'
ArduinoISP:77: error: 'int error' previously defined here
ArduinoISP:612: error: redefinition of 'int pmode'
ArduinoISP:78: error: 'int pmode' previously defined here
ArduinoISP:614: error: redefinition of 'int here'
ArduinoISP:80: error: 'int here' previously declared here
ArduinoISP:615: error: redefinition of 'uint8_t buff [256]'
ArduinoISP:81: error: 'uint8_t buff [256]' previously declared here
ArduinoISP:618: error: redefinition of 'struct param'
ArduinoISP:84: error: previous definition of 'struct param'
ArduinoISP:633: error: invalid type in declaration before ';' token
ArduinoISP:633: error: conflicting declaration 'typedef int parameter'
ArduinoISP:99: error: 'parameter' has a previous declaration as 'typedef struct param parameter'
ArduinoISP:635: error: redefinition of 'parameter param'
ArduinoISP:101: error: 'parameter param' previously declared here
ArduinoISP:638: error: redefinition of 'uint8_t hbval'
ArduinoISP:104: error: 'uint8_t hbval' previously defined here
ArduinoISP:639: error: redefinition of 'int8_t hbdelta'
ArduinoISP:105: error: 'int8_t hbdelta' previously defined here
ArduinoISP.cpp: In function 'void heartbeat()':
ArduinoISP:640: error: redefinition of 'void heartbeat()'
ArduinoISP:106: error: 'void heartbeat()' previously defined here
ArduinoISP.cpp: In function 'void loop()':
ArduinoISP:649: error: redefinition of 'void loop()'
ArduinoISP:115: error: 'void loop()' previously defined here
ArduinoISP.cpp: In function 'uint8_t getch()':
ArduinoISP:664: error: redefinition of 'uint8_t getch()'
ArduinoISP:130: error: 'uint8_t getch()' previously defined here
ArduinoISP.cpp: In function 'void pulse(int, int)':
ArduinoISP:675: error: redefinition of 'void pulse(int, int)'
ArduinoISP:141: error: 'void pulse(int, int)' previously defined here
ArduinoISP.cpp: In function 'void spi_init()':
ArduinoISP:685: error: redefinition of 'void spi_init()'
ArduinoISP:156: error: 'void spi_init()' previously defined here
ArduinoISP.cpp: In function 'void spi_wait()':
ArduinoISP:692: error: redefinition of 'void spi_wait()'
ArduinoISP:163: error: 'void spi_wait()' previously defined here
ArduinoISP.cpp: In function 'uint8_t spi_send(uint8_t)':
ArduinoISP:698: error: redefinition of 'uint8_t spi_send(uint8_t)'
ArduinoISP:169: error: 'uint8_t spi_send(uint8_t)' previously defined here
ArduinoISP.cpp: In function 'uint8_t spi_transaction(uint8_t, uint8_t, uint8_t, uint8_t)':
ArduinoISP:706: error: redefinition of 'uint8_t spi_transaction(uint8_t, uint8_t, uint8_t, uint8_t)'
ArduinoISP:177: error: 'uint8_t spi_transaction(uint8_t, uint8_t, uint8_t, uint8_t)' previously defined here
ArduinoISP.cpp: In function 'void empty_reply()':
ArduinoISP:715: error: redefinition of 'void empty_reply()'
ArduinoISP:186: error: 'void empty_reply()' previously defined here
ArduinoISP.cpp: In function 'void breply(uint8_t)':
ArduinoISP:725: error: redefinition of 'void breply(uint8_t)'
ArduinoISP:197: error: 'void breply(uint8_t)' previously defined here
ArduinoISP.cpp: In function 'void get_version(uint8_t)':
ArduinoISP:736: error: redefinition of 'void get_version(uint8_t)'
ArduinoISP:209: error: 'void get_version(uint8_t)' previously defined here
ArduinoISP.cpp: In function 'void set_parameters()':
ArduinoISP:755: error: redefinition of 'void set_parameters()'
ArduinoISP:228: error: 'void set_parameters()' previously defined here
ArduinoISP.cpp: In function 'void start_pmode()':
ArduinoISP:783: error: redefinition of 'void start_pmode()'
ArduinoISP:253: error: 'void start_pmode()' previously defined here
ArduinoISP.cpp: In function 'void end_pmode()':
ArduinoISP:799: error: redefinition of 'void end_pmode()'
ArduinoISP:269: error: 'void end_pmode()' previously defined here
ArduinoISP.cpp: In function 'void universal()':
ArduinoISP:807: error: redefinition of 'void universal()'
ArduinoISP:277: error: 'void universal()' previously defined here
ArduinoISP.cpp: In function 'void flash(uint8_t, int, uint8_t)':
ArduinoISP:818: error: redefinition of 'void flash(uint8_t, int, uint8_t)'
ArduinoISP:286: error: 'void flash(uint8_t, int, uint8_t)' previously defined here
ArduinoISP.cpp: In function 'void commit(int)':
ArduinoISP:824: error: redefinition of 'void commit(int)'
ArduinoISP:292: error: 'void commit(int)' previously defined here
ArduinoISP.cpp: In function 'int current_page(int)':
ArduinoISP:829: error: redefinition of 'int current_page(int)'
ArduinoISP:302: error: 'int current_page(int)' previously defined here
ArduinoISP.cpp: In function 'uint8_t write_flash(int)':
ArduinoISP:836: error: new declaration 'uint8_t write_flash(int)'
ArduinoISP:311: error: ambiguates old declaration 'void write_flash(int)'
ArduinoISP.cpp: In function 'uint8_t write_eeprom(int)':
ArduinoISP:856: error: redefinition of 'uint8_t write_eeprom(int)'
ArduinoISP:342: error: 'uint8_t write_eeprom(int)' previously defined here
ArduinoISP.cpp: In function 'void program_page()':
ArduinoISP:867: error: redefinition of 'void program_page()'
ArduinoISP:373: error: 'void program_page()' previously defined here
ArduinoISP:880: error: void value not ignored as it ought to be
ArduinoISP.cpp: In function 'uint8_t flash_read(uint8_t, int)':
ArduinoISP:888: error: redefinition of 'uint8_t flash_read(uint8_t, int)'
ArduinoISP:399: error: 'uint8_t flash_read(uint8_t, int)' previously defined here
ArduinoISP.cpp: In function 'char flash_read_page(int)':
ArduinoISP:895: error: redefinition of 'char flash_read_page(int)'
ArduinoISP:406: error: 'char flash_read_page(int)' previously defined here
ArduinoISP.cpp: In function 'char eeprom_read_page(int)':
ArduinoISP:906: error: redefinition of 'char eeprom_read_page(int)'
ArduinoISP:417: error: 'char eeprom_read_page(int)' previously defined here
ArduinoISP.cpp: In function 'void read_page()':
ArduinoISP:915: error: redefinition of 'void read_page()'
ArduinoISP:428: error: 'void read_page()' previously defined here
ArduinoISP.cpp: In function 'void read_signature()':
ArduinoISP:930: error: redefinition of 'void read_signature()'
ArduinoISP:445: error: 'void read_signature()' previously defined here
ArduinoISP.cpp: In function 'int avrisp()':
ArduinoISP:950: error: redefinition of 'int avrisp()'
ArduinoISP:466: error: 'int avrisp()' previously defined here

Does anyone know what might be the problem? I can't find anyone else who has gotten this error before.

Does an empty sketch compile?

void setup( void ) { }
void loop( void ) { }

Yes, it compiles perfectly fine.

Looks like the same error you have... http://code.google.com/p/arduino/issues/detail?id=518

I had the same errors; I noticed that in the sketch window, there were two tabs, each named "ArduinoISP". At first, I thought that the second tab was where the functions were located, but when I examined it more closely, it appeared to be an almost identical file. It turns out that in the Examples folder for this sketch there were two files, each called "ArduinoISP" but one had an extension of ".ino" and the other was ".pde". I removed the file with the ".pde" extension, and it compiled without error.

I don't know why the .pde file was there, but I use Sugarsync to sync my Arduino files between my development netbook and my Mac. Sugarsync may have gotten the two confused in the sync process.

MLeBlanc: I don't know why the .pde file was there, but I use Sugarsync to sync my Arduino files between my development netbook and my Mac. Sugarsync may have gotten the two confused in the sync process.

By default, Arduino 1.0 and later automatically rename PDE files to INO files. Sugarsync probably doesn't handle renamed files correctly.