PIO compiling error for nRF52832

The error I receive is this “platformio\lib\Bluefruit52Lib\src\services/BLEHidGeneric.h:73:34: error: ISO C++ forbids declaration of ‘ATTR_PACKED_STRUCT’ with no type [-fpermissive]
typedef ATTR_PACKED_STRUCT(struct)” and this error" hid_keyboard_report_t’ has not been declared". The program does compile just fine using Arduino IDE. Any help or direction would greatlt be appreciated.



This seems to have been fixed in the latest version of Adafruit code for the Nordic nRF52 BLE SoC on Arduino, which is included in the latest PlatformIO Nordic nRF52 platform.

Can you check you have platform version 3.7.0?

Version 4.0.3, sorry should have included that in the original issue. Also have version 0.13.0 for
Adafruit nRF52 Arduino Core.



I was referring to the nRF52 platform version (not to the PlatformIO itself). It’s a bit confusing as they have similar names. You’ll find it here:

From the path in your error message I also realize that you have installed the Adafruit Bluefruit nRF52 Libraries locally in your PlatformIO installation (in platformio\lib\Bluefruit52Lib).
Remove the entire directory. It’s not needed and likely outdated. If it’s declared in platformio.ini also remove it there and make sure it’s not in .pio/libdeps within your project folder either.

Then build again. It will automatically be identified and taken from platformio/packages/framework-arduinoadafruitnrf52/libraries/Bluefruit52Lib.

1 Like


Success!! Thank you, I did have Nordic nRF52 version 3.7.0. I did remove the Adafruit Bluefruit nRF52 Libraries locally in my PlatformIO installation, so that probably was the issue. I have other libraries installed locally, are they needed or can I remove them also?
I am just a beginner with PlatformIO, but really do like the platform.
Thanks again for your help

1 Like

The preferred way is to not install libraries (in PlatformIO’s lib directory) but instead declare them in platformio.ini (using libdeps). A copy will then be downloaded to .pio/libdeps within the project folder. That way different projects can have different versions of the same library, you can share your code with other people and it will immediately build, and all dependencies are clearly visible in platformio.ini.

A few days ago, I’ve removed all libraries from PlatformIO’s lib directory, and I do not plan to put anything there ever again.

Note that the Adafruit Bluefruit nRF52 Libraries (Bluefruit52Lib) are special as they belong to the Arduino core for Adafruit nRF52 based boards. So they don’t even need to be declare in platformio.ini.