Building with Library SX126xLib


I’ve successfully been able to import library SX126xLib into both Keil Studio Cloud and to MBED Studio for Mac. The problem is I cannot seem to build a simple project with this library. Whenever I try to include, as such (referencing DevKit example):
#include “mbed.h”
#include “radio.h”
#include “sx126x-hal.h”
I get this error referencing the radio.h line: In included file: ISO C++ forbids forward references to ‘enum’ types clang(forward_ref_enum)
For this line in radio.h: typedef enum RadioCommands_e RadioCommands_t;

I’ve tried a hand full of different mbed-os versions but I cannot get this library to compile. The project does not have any other libraries or components. Just the SX126xLib. Would you guys have any suggestions on how I can trouble shoot this?

Thank you in advance.


this will be probably caused by different C++ version. The library was probably written in something older than C++14 which is currently used.

The problem is on line 64 of radio.h. It looks like forward declaration which is declared in sx126x.h

typedef enum RadioCommands_e RadioCommands_t;

Try to cut out the whole enum from line 465 of sx126x.h and place it to the radio.h as replacement of line 64.

BR, Jan

Thank you for the input, Jan. That seemed to work on the Keil Studio Cloud compiler.