cyborg5 / TinyUSB_Mouse_and_Keyboard

Converts Standard Arduino Mouse.h and Keyboard.h API to be used for Tiny USB stack.
MIT License
41 stars 8 forks source link

Build with PlatformIO throws errors about multiple definition of some symbols #7

Open oscaracena opened 3 months ago

oscaracena commented 3 months ago

The problem is related to the PlatformIO LDF as, by default, it does not evaluate the C++ preprocessor directives (for speed reasons), so even when you set the flag USE_TINYUSB, the LDF will include HID, Keyboard and Mouse as library deps, generating the duplicated symbols.

To fix it, the user can just add the following line to the platformio.ini file:

[env:...]
...

; evaluate C/C++ Preprocessor conditional syntax
lib_ldf_mode = chain+

I add this issue just as some sort of documentation, and maybe @cyborg5 could update the README... 😉

fabio-s-franco commented 3 months ago

That didn't solve it for me (rp2040 pico). Wondering if there is some other dependency issue.

fabio-s-franco commented 3 months ago

That didn't solve it for me (rp2040 pico). Wondering if there is some other dependency issue.

Nevermind, order of the #define USE_TINYUSB(needed to be before the include)