Skip to content

challenge with enum value and FastLed library #4

Open
@JM-FRANCE

Description

@JM-FRANCE

you are using this enum

enum CLICK : uint16_t {FAST = 200, DONE = 500};

challenge is that the fastLed library is also using DONE for a #define

so if you try to compile

#include <FastLED.h>
#include <Toggle.h>

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

the compiler will complain about the double definition

first it's a cryptic

~/Documents/Arduino/libraries/FastLED/src/platforms/avr/clockless_trinket.h:308:14: error: expected identifier before 'asm'
 #define DONE asm __volatile__("2:" ASM_VARS );
              ^

but then everything is revealed

~/Documents/Arduino/libraries/Toggle/src/Toggle.h:50:40: note: in expansion of macro 'DONE'
     enum CLICK : uint16_t {FAST = 200, DONE = 500};
                                        ^~~~

I guess the easiest fix is to change the enum's keyword or create a private namespace for your library (or change the fasted library and its poor choice of using #define...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions