mWebSockets icon indicating copy to clipboard operation
mWebSockets copied to clipboard

'SerialUSB' was not declared in this scope

Open LaudixGit opened this issue 3 years ago • 7 comments

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 avatar Dec 29 '21 02:12 LaudixGit

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 avatar Dec 29 '21 02:12 LaudixGit

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

LaudixGit avatar Dec 29 '21 02:12 LaudixGit

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

skaarj1989 avatar Dec 31 '21 09:12 skaarj1989

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

LaudixGit avatar Dec 31 '21 17:12 LaudixGit

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?

skaarj1989 avatar Dec 31 '21 17:12 skaarj1989

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

LaudixGit avatar Dec 31 '21 23:12 LaudixGit

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[bot] avatar Jan 31 '22 01:01 stale[bot]