Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

challenge with enum value and FastLed library #4

Open
JM-FRANCE opened this issue Sep 29, 2023 · 0 comments
Open

challenge with enum value and FastLed library #4

JM-FRANCE opened this issue Sep 29, 2023 · 0 comments

Comments

@JM-FRANCE
Copy link

JM-FRANCE commented Sep 29, 2023

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...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant