I was looking for guidance on how to go about troubleshooting this
There IS a way to debug this sort of "really mysterious" problem, but it's relatively complicated - it requires that you be familiar with using command line tools on your system, or at least some "feature-full" compiler access beyond what the Arduino IDE provides...
First, run the IDE "verify" and let it generate the "sketchname.cpp" file off in some temporary directory, along with (assuming you used "verbose" compilation) the exact command needed to compile it.
Start up a command-line processor and connect to the appropriate directory (with the .cpp file.)
Copy and paste the compile line into the window; you should get the same error you did from the IDE. (Just for confirmation.)
Now, replace the "-c" option in the failing compile line with "-E", and replace "-o mysketch.cpp.o" with "-o XX.cpp"
(This will save the pre-processed source code, with all the #include and macro definitions DONE, in XX.cpp.) (use .c if the file generating the error is a .c file.)
In the original compile line (with -c), replace the source file name with XX.cpp", so that you're recompiling the pre-processed code. (At this point, many of the the compile options no longer do anything, but they can be more difficult to get rid of than to keep.) You'll still get the same error message, pointing to other files, because the preprocessed file still contains lines like:
# 1 "/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_digital.c"
Edit the preprocessed code and remove all of those lines that contain a "#" to prevent this; maybe save the results as XX1.cpp.
Compile the edited file. You should now get the same error, but it should point directly into the same file, at bare C code that should make the error "obvious."
Work backward from the error you found to the original file, and fix the problem!
So, for example - I have removed the last semicolon from pins_arduino.h, and I get the error from the IDE:
In file included from /Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_digital.c:28:0:
/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_private.h:46:1: error: expected ',' or ';' before 'uint32_t'
uint32_t countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops);
Which is not at all where the error is. But I do:
cd/var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build6347104727652062779.tmp
[color=purple]BillW-MacOSX-2<10025>[/color] /Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/tools/avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/variants/standard /Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_digital.c -o /var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build6347104727652062779.tmp/wiring_digital.c.o
In file included from /Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_digital.c:28:0:
/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_private.h:46:1: error: expected ',' or ';' before 'uint32_t'
uint32_t countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops);
^
[color=teal][Same error as before][/color]
BillW-MacOSX-2<10026> /Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/tools/avr/bin/avr-gcc [color=purple][color=red]-E[/color] [/color]-g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/variants/standard /Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_digital.c [color=red]-o XX.c[/color]
[color=purple]BillW-MacOSX-2<10027> [/color]/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/tools/avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/variants/standard[color=red] XX.c -o XX.o [/color]
In file included from /Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_digital.c:28:0:
/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_private.h:46:1: error: expected ',' or ';' before 'uint32_t'
uint32_t countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops);
^
[color=purple]BillW-MacOSX-2<10028> [/color]ed XX.c
[color=green][remove the "#" lines][/color]
[color=purple]BillW-MacOSX-2<10029>[/color] /Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/ols/avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/arduino/Arduino-1.6.5.app/Contents/Java/hardware/arduino/avr/variants/standard [color=red]XX1.c[/color] -o XX.o
XX1.c:1001:1: error: expected ',' or ';' before 'uint32_t'
uint32_t countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops);
^[color=purple]
[color=green][Ah hah! Line 1001][/color]
BillW-MacOSX-2<10030>[/color] ed XX1.c
[lines around 1001 read:
const uint8_t __attribute__((__progmem__)) digital_pin_to_timer_PGM[] = {
:
0,
0,
0,
0,
}
uint32_t countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops);
typedef void (*voidFuncPtr)(void);
[an "obvious" missing semicolon after the digital_pin_to_timer_PGM structure definition! Done!]