Linux Conflict w/ Digistump DigiKeyboard.h include

I recently installed the Arduino IDE (v. 1.8.6) on Linux Mint and followed that up with the Digistump DigiKeyboard library. I've done this in the past but this time, I'm getting the following errors when I try to compile anything with the include for the DigiKeyboard.h file:

Arduino: 1.8.6 (Linux), Board: "Digispark (Default - 16.5mhz)"

In file included from /home/{{USER}}/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/avr/include/avr/io.h:99:0,
                 from /home/{{USER}}/.arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/usbportability.h:121,
                 from /home/{{USER}}/.arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/usbdrvasm.S:19:
/home/{{USER}}/.arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/usbdrv.h:662:33: error: operator '*' has no left operand
 #       define USB_INTR_PENDING GIFR
                                 ^
/home/{{USER}}/.arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/usbdrvasm.S:74:5: note: in expansion of macro 'USB_INTR_PENDING'
 #if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */
     ^
exit status 1
Error compiling for board Digispark (Default - 16.5mhz).

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

This doesn't seem to be the issue on OSX. Does anyone have any suggestions on how to fix this? There was one suggestion made in the forum to update commenting on new lines, but that hasn't proven to work yet.

SOLVED (sort of): For folks who are having trouble with the DigiStump AVR boards, specifically when including the DigiKeyboard.h library in the Arduino IDE version 1.8.6, there is a light at the end of the tunnel. Simply put, use version 1.8.5. I tested the following versions as well and they all were affected:

  • 1.8.6 - stable
  • 1.8.6 - nightly build
  • 1.9.0 - beta

There has been some allusion to the fact that there is a bug with regards to comments being on the same line as statements. I have tried to debug this and haven't found that to be credible (at least in my tests). If this isn't filed as an issue, I can file it shortly.

pennsylforniageek:
This doesn't seem to be the issue on OSX.

It happens for me on Windows.

pennsylforniageek:
There has been some allusion to the fact that there is a bug with regards to comments being on the same line as statements. I have tried to debug this and haven't found that to be credible (at least in my tests).

I've investigated this more and indeed it is not related to the combination of inline comments and macros. There is a problem with that (see: does not give a valid preprocessing token/Since 1.8.6 · Issue #7930 · arduino/Arduino · GitHub) but it's not the direct cause of this error.

Here's a MVCE for this problem:

#if GIFR < 0x40
#endif
void setup() {}
void loop() {}

The preprocessed version is:

#if (*(volatile uint8_t *)((0x3A) + 0x20)) < 0x40
#endif
void setup() {}
void loop() {}

The error comes from an assembly language file that is treated as C++ in the library detection phase. :o

See [SOLVED] Digispark Keyboard not working - #6 by oqibidipo - Installation & Troubleshooting - Arduino Forum

My MVCE doesn't use any assembly files. How do you explain that?

Take a good look at it. Does this make any sense to the preprocessor?

#if (*(volatile uint8_t *)((0x3A) + 0x20)) < 0x40

When compilng assembly, GIFR is just the address without any pointer acrobatics:

#if ((0x3A) + 0x20) < 0x40