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

'SerialUSB' was not declared in this scope #57

Open
LaudixGit opened this issue Dec 29, 2021 · 7 comments
Open

'SerialUSB' was not declared in this scope #57

LaudixGit opened this issue Dec 29, 2021 · 7 comments
Labels

Comments

@LaudixGit
Copy link

Describe the bug
Compile fails

Using the unmodified "simple-server" example

Environment info

  • IDE w/version: Arduino 1.8.15
  • Platform/Board: Adafruit Feather M4 Express (SAMD51)
  • Network controller (shield or module):
  • mWebSockets Version: 1.5.1

Expected behavior
SAMD51 should be detected correctly

Failure log

/home/laudix/Arduino/libraries/mWebSockets/src/utility.cpp: In function 'void printf(const __FlashStringHelper*, ...)':
/home/laudix/Arduino/libraries/mWebSockets/src/utility.cpp:20:3: error: 'SerialUSB' was not declared in this scope
   SerialUSB.print(buffer);
   ^~~~~~~~~
/home/laudix/Arduino/libraries/mWebSockets/src/utility.cpp:20:3: note: suggested alternative: 'Serial'
   SerialUSB.print(buffer);
   ^~~~~~~~~
   Serial
Multiple libraries were found for "Ethernet.h"
 Used: /opt/arduino-1.8.15/libraries/Ethernet
 Not used: /home/laudix/Arduino/libraries/UIPEthernet
Multiple libraries were found for "Adafruit_ZeroDMA.h"
 Used: /home/laudix/.arduino15/packages/adafruit/hardware/samd/1.7.5/libraries/Adafruit_ZeroDMA
 Not used: /home/laudix/Arduino/libraries/Adafruit_Zero_DMA_Library
exit status 1
Error compiling for board Adafruit Feather M4 Express (SAMD51).

Additional context
editing platform.h (as suggested) didn't repair so reverted back

@LaudixGit
Copy link
Author

LaudixGit commented Dec 29, 2021

note: forcing the use of Serial doesn't help because utility.cpp neglects to use the _SERIAL value

#if PLATFORM_ARCH == PLATFORM_ARCHITECTURE_SAMD21XXX
#define _SERIAL SerialUSB
#else
#define _SERIAL Serial
#endif

@LaudixGit
Copy link
Author

Compiles when I comment-out line 20 of
/Arduino/libraries/mWebSockets/src/utility.cpp

@skaarj1989
Copy link
Owner

Can't find Adafruit Feather M4 Express (SAMD51) in Arduino Board Manager, where did you get it?

@LaudixGit
Copy link
Author

@skaarj1989 The Board Installer is part of a Adafruit package.
There's the Adafruit sales page, and
I followed their instructions
to add their board to the IDE via the "Additional Boards Manager" in the preferences settings.

The enabled me to use Board Manager to install both "Arduino SAMD Boards (32-Bits ARM Cortex-M0+" and "Adafruit SAMD Boards", and finally,
select Adafruit SAMD (32-bits ARM Cortex-M0+ and Cortex-M4) Boards / Adafruit Feather M4 Express (SAMD51)

A little more research this morning to list the variables with
grep board= find . -name boards.txt | cut -f2 -d= | sort -u
And I think the relevant IDE variable, to identify the board, is "FEATHER_M4"
(but that is a guess, I am not an expert)

@skaarj1989
Copy link
Owner

skaarj1989 commented Dec 31, 2021

I will submit a fix for this soon someday.

For a quick workaround, you can change SerialUSB to Serial. This will give you some debug information (in opposition to comment-out)
Anyway, have you managed to get it work?

@LaudixGit
Copy link
Author

Yes. I have completed my task. But it will be nice to have the your update so future upgrades will "just work" - no modifications needed

@stale
Copy link

stale bot commented Jan 31, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 31, 2022
@skaarj1989 skaarj1989 added pinned and removed stale labels Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants